From e80c2a2f1a4cf6a5fca70ca432132877f397be66 Mon Sep 17 00:00:00 2001 From: Britney Fransen Date: Tue, 18 Oct 2022 12:38:19 -0400 Subject: kmsync.sh: add update_db option --- build_tools/bin/kmsync.sh | 59 ++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/build_tools/bin/kmsync.sh b/build_tools/bin/kmsync.sh index 42b001b..9b0a992 100755 --- a/build_tools/bin/kmsync.sh +++ b/build_tools/bin/kmsync.sh @@ -1,8 +1,9 @@ #!/bin/bash -#This script will create and synchronize a local package mirror with the repository (as defined below) on linhes.org, it will also update the database. -#This script uses a shared account on linhes.org. DO NOT change the account name -# and dont' ask for the password, instead setup ssh keys. -# + +#This script will create and synchronize a local package mirror with the repository (as defined below) on linhes.org, +# it will also update the database. +#This script uses a shared account on linhes.org. +# DO NOT change the account name and dont' ask for the password, instead setup ssh keys. if [ -e /etc/makepkg.conf ] @@ -29,7 +30,7 @@ function sync_dirs { #first bring down new changes from linhes.org echo "--------" echo - echo "Syncing the packages with linhes.org" + echo "Syncing the packages with linhes.org" echo echo "--------" unison km-down -logfile /tmp/unison-down.log -auto -batch -numericids ssh://reposync@linhes.org/$REMOTE $LOCAL @@ -43,7 +44,11 @@ function sync_dirs { fi #update the local database - update_db_repo.sh $LOCAL $3 + if [ "$4" == "update_db" ] + then + echo "Updating the whole db..." + update_db_repo.sh $LOCAL $3 + fi #push the database back echo "--------" @@ -51,8 +56,8 @@ function sync_dirs { echo "Pushing the pkg database to linhes.org" echo echo "--------" - unison km-up -logfile /tmp/unison-up.log -auto -batch -numericids -force $LOCAL $LOCAL ssh://reposync@linhes.org/$REMOTE - #scp $LOCAL/*.db.tar.gz reposync@linhes.org:$REMOTE/ + unison km-up -logfile /tmp/unison-up.log -auto -batch -numericids -force $LOCAL $LOCAL ssh://reposync@linhes.org/$REMOTE + #scp $LOCAL/*.db.tar.gz reposync@linhes.org:$REMOTE/ echo "-------------------------------------------------------" echo "----------- Finished with $3 -----------" @@ -62,41 +67,40 @@ function sync_dirs { function source_sync () { src_repo=$1 - case $1 in + case $1 in testing ) echo "updating source packages" REMOTE_DIR=/srv/www/repo/src_packages/core-testing LOCAL=/data/pkg_repo/src_packages/core-testing unison km-down -logfile /tmp/unison-down.log -auto -batch -numericids ssh://reposync@linhes.org/$REMOTE_DIR $LOCAL - + REMOTE_DIR=/srv/www/repo/src_packages/extra-testing LOCAL=/data/pkg_repo/src_packages/extra-testing unison km-down -logfile /tmp/unison-down.log -auto -batch -numericids ssh://reposync@linhes.org/$REMOTE_DIR $LOCAL ;; - release ) + release ) echo "updating source packages" REMOTE_DIR=/srv/www/repo/src_packages/core LOCAL=/data/pkg_repo/src_packages/core unison km-down -logfile /tmp/unison-down.log -auto -batch -numericids ssh://reposync@linhes.org/$REMOTE_DIR $LOCAL - + REMOTE_DIR=/srv/www/repo/src_packages/extra LOCAL=/data/pkg_repo/src_packages/extra unison km-down -logfile /tmp/unison-down.log -auto -batch -numericids ssh://reposync@linhes.org/$REMOTE_DIR $LOCAL ;; - chroot-devel ) + + chroot-devel ) echo "updating source packages" REMOTE_DIR=/srv/www/repo/src_packages/chroot-devel LOCAL=/data/pkg_repo/src_packages/chroot-devel unison km-down -logfile /tmp/unison-down.log -auto -batch -numericids ssh://reposync@linhes.org/$REMOTE_DIR $LOCAL ;; - - - *) + *) echo "need to know the source repository [testing|release|chroot-devel]" exit 1 - ;; + ;; esac } @@ -124,30 +128,28 @@ fi - - clear case $1 in testing) #sync_dirs $REMOTE $LOCAL - sync_dirs $REMOTE_DIR/$CARCH/core-testing $DOCROOT/core-testing core-testing - sync_dirs $REMOTE_DIR/$CARCH/extra-testing $DOCROOT/extra-testing extra-testing + sync_dirs $REMOTE_DIR/$CARCH/core-testing $DOCROOT/core-testing core-testing $2 + sync_dirs $REMOTE_DIR/$CARCH/extra-testing $DOCROOT/extra-testing extra-testing $2 source_sync testing - pacman_sync + pacman_sync ;; release) - sync_dirs $REMOTE_DIR/$CARCH/core $DOCROOT/core core - sync_dirs $REMOTE_DIR/$CARCH/extra $DOCROOT/extra extra + sync_dirs $REMOTE_DIR/$CARCH/core $DOCROOT/core core $2 + sync_dirs $REMOTE_DIR/$CARCH/extra $DOCROOT/extra extra $2 source_sync release - pacman_sync + pacman_sync ;; chroot-devel) echo "will update chroot-devel" - sync_dirs $REMOTE_DIR/$CARCH/chroot-devel $DOCROOT/chroot-devel chroot-devel + sync_dirs $REMOTE_DIR/$CARCH/chroot-devel $DOCROOT/chroot-devel chroot-devel $2 source_sync chroot-devel - pacman_sync + pacman_sync ;; source) @@ -163,9 +165,8 @@ case $1 in echo "invalid options" echo "kmsync.sh (testing|release|chroot-devel|source[testing|release|chroot-devel]) " echo - echo "EX: kmsync.sh testing <= will sync the testing repo with km.net update the local database and resync with km.net" + echo "EX: kmsync.sh testing update_db <= will sync the testing repo with km.net update the local database and resync with km.net" #echo "kmsync.sh testing oneway <= will syncthe testing repo with km.net update the local database" - ;; esac echo "Finished." -- cgit v0.12