summaryrefslogtreecommitdiffstats
path: root/build_tools/bin/kmsync.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build_tools/bin/kmsync.sh')
-rwxr-xr-xbuild_tools/bin/kmsync.sh96
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