summaryrefslogtreecommitdiffstats
path: root/pkg-get/syn
diff options
context:
space:
mode:
authortnut <tnut at nutyx dot com>2012-01-08 12:12:28 +0100
committertnut <tnut at nutyx dot com>2012-01-08 12:12:28 +0100
commit9291e062cb24bac5d7c7059d4dc64669c1917b33 (patch)
treeae6f7e4fb2769d6c53b214c5e0b4d862f1df98dc /pkg-get/syn
parentc9972ec7f32bf9d37388e853fe9bf633e242d05a (diff)
downloadnutyx-pakxe-9291e062cb24bac5d7c7059d4dc64669c1917b33.tar.gz
nutyx-pakxe-9291e062cb24bac5d7c7059d4dc64669c1917b33.tar.bz2
nutyx-pakxe-9291e062cb24bac5d7c7059d4dc64669c1917b33.tar.xz
nutyx-pakxe-9291e062cb24bac5d7c7059d4dc64669c1917b33.zip
aaabasicfs 2011-3 et split des dépot base et extra en 2 git séparé
Diffstat (limited to 'pkg-get/syn')
-rw-r--r--pkg-get/syn44
1 files changed, 44 insertions, 0 deletions
diff --git a/pkg-get/syn b/pkg-get/syn
new file mode 100644
index 000000000..68a38c4b2
--- /dev/null
+++ b/pkg-get/syn
@@ -0,0 +1,44 @@
+#!/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
+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