From b36b1fb0d0e0106b40879d54f85616e6217bcc50 Mon Sep 17 00:00:00 2001 From: tnut Date: Sun, 6 Feb 2011 14:24:08 +0100 Subject: pkg-get-awk, correction de quelques bugs --- base/pkg-get-awk/.footprint.i686 | 1 + base/pkg-get-awk/.footprint.x86_64 | 1 + base/pkg-get-awk/.md5sum.i686 | 3 ++- base/pkg-get-awk/.md5sum.x86_64 | 3 ++- base/pkg-get-awk/Pkgfile | 5 ++-- base/pkg-get-awk/pkg-get.awk | 17 +++++++------ base/pkg-get-awk/post-install | 11 +++++++++ base/pkg-get-awk/syn | 50 ++++++++++++++++++++++++++++++++++++++ 8 files changed, 80 insertions(+), 11 deletions(-) create mode 100644 base/pkg-get-awk/syn (limited to 'base') diff --git a/base/pkg-get-awk/.footprint.i686 b/base/pkg-get-awk/.footprint.i686 index 0cc820c4f..5e4a825b5 100644 --- a/base/pkg-get-awk/.footprint.i686 +++ b/base/pkg-get-awk/.footprint.i686 @@ -3,6 +3,7 @@ drwxr-xr-x root/root etc/ drwxr-xr-x root/root usr/ drwxr-xr-x root/root usr/bin/ -rwxr-xr-x root/root usr/bin/pkg-get.awk +-rwxr-xr-x root/root usr/bin/syn.awk drwxr-xr-x root/root usr/share/ drwxr-xr-x root/root usr/share/locale/ drwxr-xr-x root/root usr/share/locale/en/ diff --git a/base/pkg-get-awk/.footprint.x86_64 b/base/pkg-get-awk/.footprint.x86_64 index 0cc820c4f..5e4a825b5 100644 --- a/base/pkg-get-awk/.footprint.x86_64 +++ b/base/pkg-get-awk/.footprint.x86_64 @@ -3,6 +3,7 @@ drwxr-xr-x root/root etc/ drwxr-xr-x root/root usr/ drwxr-xr-x root/root usr/bin/ -rwxr-xr-x root/root usr/bin/pkg-get.awk +-rwxr-xr-x root/root usr/bin/syn.awk drwxr-xr-x root/root usr/share/ drwxr-xr-x root/root usr/share/locale/ drwxr-xr-x root/root usr/share/locale/en/ diff --git a/base/pkg-get-awk/.md5sum.i686 b/base/pkg-get-awk/.md5sum.i686 index afb432901..a38f7b77d 100644 --- a/base/pkg-get-awk/.md5sum.i686 +++ b/base/pkg-get-awk/.md5sum.i686 @@ -1,3 +1,4 @@ 3e833be041e5cb66c747c1d6b9a6258b pkg-get-awk.conf -cb88f633485de9da542bc0f1da60bcf0 pkg-get.awk +0b86cf36a21f3e69fa571c055151d50d pkg-get.awk d3457c0e21dc92ee3b86ed3a0d5e094e pkg-get.po +afe269237467ab0650b043b933ba993a syn diff --git a/base/pkg-get-awk/.md5sum.x86_64 b/base/pkg-get-awk/.md5sum.x86_64 index afb432901..a38f7b77d 100644 --- a/base/pkg-get-awk/.md5sum.x86_64 +++ b/base/pkg-get-awk/.md5sum.x86_64 @@ -1,3 +1,4 @@ 3e833be041e5cb66c747c1d6b9a6258b pkg-get-awk.conf -cb88f633485de9da542bc0f1da60bcf0 pkg-get.awk +0b86cf36a21f3e69fa571c055151d50d pkg-get.awk d3457c0e21dc92ee3b86ed3a0d5e094e pkg-get.po +afe269237467ab0650b043b933ba993a syn diff --git a/base/pkg-get-awk/Pkgfile b/base/pkg-get-awk/Pkgfile index 950667e33..4948d502b 100644 --- a/base/pkg-get-awk/Pkgfile +++ b/base/pkg-get-awk/Pkgfile @@ -6,8 +6,8 @@ name=pkg-get-awk version=0.3.1 -release=2 -source=(pkg-get.awk pkg-get-awk.conf pkg-get.po) +release=3 +source=(syn pkg-get.awk pkg-get-awk.conf pkg-get.po) PKGMK_KEEP_LOCALES=yes @@ -15,6 +15,7 @@ build() { msgfmt pkg-get.po -o pkg-get.mo mkdir -p $PKG/usr/bin install -m 755 pkg-get.awk $PKG/usr/bin + install -m 755 syn $PKG/usr/bin/syn.awk mkdir -p $PKG/etc install -m 664 pkg-get-awk.conf $PKG/etc mkdir -p $PKG/usr/share/locale/en/LC_MESSAGES diff --git a/base/pkg-get-awk/pkg-get.awk b/base/pkg-get-awk/pkg-get.awk index 801b736a8..5478a7a0e 100755 --- a/base/pkg-get-awk/pkg-get.awk +++ b/base/pkg-get-awk/pkg-get.awk @@ -23,7 +23,7 @@ function configs( a, i, k, n, old_FS) PRE = "n" POST = "n" PKGDIR[0] = "/srv/NuTyX/release/" - WEBDIR[0] = "http://nutyx.meticul.eu/attapu/i686/release/" + WEBDIR[0] = "http://nutyx.meticul.eu/pakxe/x86_64/release/" # arguments OPER=(ARGC>1) ? ARGV[1] : "" @@ -158,7 +158,7 @@ function depends2(Pkg, Fl, a, i, n, c) c= (tb_DB[a[i]]==tb_REPO[a[i]]) ? "i" : "u" else c=" " - printf("[%c] %s%s\n", c, S, a[i]) + printf(" [%c] %s%s\n", c, S, a[i]) } } S = (Fl=="--d") ? substr(S,4) : "" @@ -187,9 +187,10 @@ function depinst2(Pkg, a, i, n) if (a[i] in tb_DEPS) depinst2(a[i]) if (!(a[i] in tb_DB)) - install2(a[i], "inst") + install2(a[i], "") } } + install2(Pkg, "") } @@ -221,7 +222,7 @@ function download(pak, a, cmd, j, pakw, rep, WEBREPO) if (rep=="y") { pakw = pak sub("#", "%23", pakw) - cmd="wget -O "tb_PKGDIR[a[1]] pak " " WEBREPO pakw + cmd="wget --no-directories --tries=3 --waitretry=3 "tb_PKGDIR[a[1]] pak " " WEBREPO pakw if ("--dry" in tb_OPT) { print "\033[1;34m" cmd "\033[1;0m" } else { @@ -334,8 +335,10 @@ function install( i) function install2(Pkg, Oper, cmd, i, pak) { - pak=Pkg"#"tb_REPO[Pkg] ".pkg.tar.xz" - download(pak) + if (tb_REPO[Pkg] != "" ){ + pak=Pkg"#"tb_REPO[Pkg] ".pkg.tar.xz" + download(pak) + } if ("-do" in tb_OPT) return @@ -654,7 +657,7 @@ function sync( cmd, i, j, pak) for (j=0; j "") { for (i=1; i<=4; i++) { - cmd="wget -O "PKGDIR[j] pak[i] " " WEBDIR[j] pak[i] + cmd="wget -q -O "PKGDIR[j] pak[i] " " WEBDIR[j] pak[i] if ("--dry" in tb_OPT) { print "\033[1;34m" cmd "\033[1;0m" } else { diff --git a/base/pkg-get-awk/post-install b/base/pkg-get-awk/post-install index 63e4e41c8..249cbf8fc 100755 --- a/base/pkg-get-awk/post-install +++ b/base/pkg-get-awk/post-install @@ -1,6 +1,7 @@ #!/bin/sh pkf=/usr/bin/pkg-get +syn=/usr/bin/syn if [ -L $pkf ]; then rm $pkf else @@ -9,11 +10,21 @@ else mv $pkf $pkf.pl fi fi +if [ -L $syn ]; then + rm $syn +else + file $syn | grep bash >/dev/null + if [ $? -eq 0 ]; then + mv $syn $syn.old + fi +fi if [ -f $pkf ]; then echo "pkg-get-awk_post_install: ERREUR, le fichier $pkf existe déjà !!!" exit 1 fi ln -s /usr/bin/pkg-get.awk $pkf +ln -s /usr/bin/syn.awk $syn if [ ! -f /etc/pkg-get.conf ]; then cp -p /etc/pkg-get-awk.conf /etc/pkg-get.conf fi + diff --git a/base/pkg-get-awk/syn b/base/pkg-get-awk/syn new file mode 100644 index 000000000..394d09845 --- /dev/null +++ b/base/pkg-get-awk/syn @@ -0,0 +1,50 @@ +#!/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 +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 -- cgit v1.2.3-70-g09d2