diff options
author | James Meyer <James.meyer@operamail.com> | 2008-10-02 03:23:45 (GMT) |
---|---|---|
committer | James Meyer <James.meyer@operamail.com> | 2008-10-02 03:23:45 (GMT) |
commit | 618d4ad515a93d1e48934be5846edd71270171ec (patch) | |
tree | a22a9294af81215d4a7b1053e5fdb4d746f39d41 /build_tools/bin/kmsync.sh | |
download | linhes_dev-618d4ad515a93d1e48934be5846edd71270171ec.zip |
initital import
Diffstat (limited to 'build_tools/bin/kmsync.sh')
-rwxr-xr-x | build_tools/bin/kmsync.sh | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/build_tools/bin/kmsync.sh b/build_tools/bin/kmsync.sh new file mode 100755 index 0000000..6506b56 --- /dev/null +++ b/build_tools/bin/kmsync.sh @@ -0,0 +1,96 @@ +#!/bin/bash +#This script will create and synchronize a local package mirror with the repository (as defined below) on knoppmyth.net, it will also update the database. +#This script uses a shared account on knoppmyth.net. DO NOT change the account name +# and dont' ask for the password, instead setup ssh keys. +# + + +if [ -e /etc/makepkg.conf ] +then + . /etc/makepkg.conf +else + echo "couldn't find /etc/makepkg.conf" +fi +cwd=`dirname $0` +REMOTE_DIR=/mount/repository/repo +DOCROOT=/data/pkg_repo/$CARCH + +#export UNISON="/root/.unison" +export UNISON="/data/pkg_repo/.unison" + +function sync_dirs { + REMOTE=$1 + LOCAL=$2 + + echo " Updating $3 " + echo "________________________________________________________" + + #first bring down new changes from knoppmyth.net + unison km-down -terse -logfile /tmp/unison-down.log -auto -batch -numericids ssh://reposync@knoppmyth.net/$REMOTE $LOCAL + if [ ! $? = 0 ] + then + echo "#######################################################" + echo "## ERRORS OCCURED ##" + echo "#######################################################" + exit 1 + + fi + #update the local database + update_db_repo.sh $LOCAL $3 + + #push the database back + unison km-up -logfile /tmp/unison-up.log -auto -batch -numericids ssh://reposync@knoppmyth.net/$REMOTE $LOCAL + echo "-------------------------------------------------------" + echo "----------- Finished with $3 -----------" + echo "-------------------------------------------------------" + + + + +} +#--------------------------------------------------------------- +if [ ! -d $UNISON ] +then + mkdir $UNISON +fi + +if [ ! -f $UNISON/km-down.prf ] +then + cp -f $cwd/km-down.prf $UNISON/ +fi + +if [ ! -f $UNISON/km-up.prf ] +then + cp -f $cwd/km-up.prf $UNISON/ +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 + ;; + + release) + sync_dirs $REMOTE_DIR/$CARCH/core $DOCROOT/core core + sync_dirs $REMOTE_DIR/$CARCH/extra $DOCROOT/extra extra + ;; + + chroot-devel) + echo "will update chroot-devel" + sync_dirs $REMOTE_DIR/$CARCH/chroot-devel $DOCROOT/chroot-devel chroot-devel + ;; + *) + echo "invalid options" + echo "kmsync.sh (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 "kmsync.sh testing oneway <= will syncthe testing repo with km.net update the local database" + + ;; +esac +echo "Finished." +# End |