diff options
author | tnut <thierryn1 at hispeed dot ch> | 2011-03-27 17:10:11 +0200 |
---|---|---|
committer | tnut <thierryn1 at hispeed dot ch> | 2011-03-27 17:10:11 +0200 |
commit | 01ea6ca4ac66ecdce3f6fc42158a5af8185609bb (patch) | |
tree | fc66000d93e79c58ada4e2091dcfc3bb3d253e58 /base/pkg-repgen/syn | |
parent | 5535fcb06bc7fd1c0ce5dff521940cb40d362545 (diff) | |
download | nutyx-pakxe-01ea6ca4ac66ecdce3f6fc42158a5af8185609bb.tar.gz nutyx-pakxe-01ea6ca4ac66ecdce3f6fc42158a5af8185609bb.tar.bz2 nutyx-pakxe-01ea6ca4ac66ecdce3f6fc42158a5af8185609bb.tar.xz nutyx-pakxe-01ea6ca4ac66ecdce3f6fc42158a5af8185609bb.zip |
pkg-repgen, ajout port
Diffstat (limited to 'base/pkg-repgen/syn')
-rw-r--r-- | base/pkg-repgen/syn | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/base/pkg-repgen/syn b/base/pkg-repgen/syn new file mode 100644 index 000000000..d29fcd6f7 --- /dev/null +++ b/base/pkg-repgen/syn @@ -0,0 +1,58 @@ +#!/bin/bash +MediaDepot=/media/cdrom/depot +Depot=/srv/NuTyX +find_cd() { +EXPECT_LABEL="nutyxcd" +let PKGNB=0 +for SYS in /sys/block/sd* /sys/block/sr* ; do + if [ ! -d "$SYS" ]; then continue; fi + DEV=/dev/${SYS##*/} + LABEL=`dd if=$DEV bs=1 skip=32808 count=32 2>/dev/null` + if [ $LABEL == $EXPECT_LABEL ] 2>/dev/null ; then + mkdir -p /media/cdrom 2>/dev/null + mount $DEV /media/cdrom + if [ ! -d /media/cdrom/depot ]; then + umount -n /media/cdrom + fi + break + fi +done +} +if [ ! "$EUID" -eq 0 ]; then + echo "Seul le compte root peut synchroniser les ports NuTyX" + exit 1 +fi +if ! mountpoint /media/cdrom > /dev/null; then + find_cd +fi +if [ ! -L /depot ]; then + for i in `cat /etc/pkg-get.conf |grep -v ^#|grep http|cut -d "|" -f 1|cut -d" " -f2|cut -d"/" -f4` + do + if [ -a $Depot/$i ]; then + rm -r $Depot/$i + fi + done + pkg-get sync + for i in `cat /etc/pkg-get.conf |grep -v ^#|grep http|cut -d "|" -f 1|cut -d" " -f2|cut -d"/" -f4` + do + if [ -d $MediaDepot/$i ]; then + rm -r $Depot/$i > /dev/null 2>&1 + mkdir -p $Depot/$i + for j in $MediaDepot/$i/*.xz + do + let PKGNB=$PKGNB+1 + + fj=`basename $j` + ln -sf $MediaDepot/$i/$fj $Depot/$i/$fj + echo -n -e "$PKGNB Paquets trouvés sur le média\r" + done + echo "$PKGNB Paquets trouvés sur le média" + cp $MediaDepot/$i/PKG* $Depot/$i/ + fi + done +else + for i in `cat /etc/pkg-get.conf |grep -v ^#|grep http|cut -d "|" -f 1|cut -d" " -f2|cut -d"/" -f4` + do + rsync -avuz --delete-before rsync://nutyx.meticul.eu/nutyx/attapu/i686/$i/ $Depot/$i/ + done +fi |