From 8a24b1b96329f7a7052e6d9f4bd77ba73858fbf6 Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 6 Mar 2011 21:57:22 +0100 Subject: pkg-get-awk, corrections bugs --- base/pkg-get-awk/pkg-get.awk | 64 +++++++++++++++++++++++++++---------------- base/pkg-get-awk/pkg-get.po | 2 +- base/pkg-get-awk/post-install | 30 -------------------- 3 files changed, 41 insertions(+), 55 deletions(-) delete mode 100755 base/pkg-get-awk/post-install diff --git a/base/pkg-get-awk/pkg-get.awk b/base/pkg-get-awk/pkg-get.awk index f2ec5cc48..7206dfc55 100755 --- a/base/pkg-get-awk/pkg-get.awk +++ b/base/pkg-get-awk/pkg-get.awk @@ -14,7 +14,7 @@ function configs( a, i, k, n, old_FS) n=split(ENVIRON["_"],a,"/") NPKG = a[n] VERSION = "0.3.2" - DATE = "2011-02-19" + DATE = "2011-03-06" # defauts CONF = "/etc/pkg-get.conf" @@ -166,9 +166,13 @@ function depends2(Pkg, Fl, a, i, n, c) function depinst( i) { verif_if_root() + load_REPO() + if (!(PKG in tb_REPO)) { + print _"Paquet" " " _"indisponible" ": "PKG + exit 1 + } load_DB() load_DEPS() - load_REPO() for (i=1; i<=nPKG; i++) { if (tb_PKG[i] in tb_DB) print _"Le paquet" " " tb_PKG[i] " " _"est déjà installé" @@ -181,17 +185,23 @@ function depinst( i) function depinst2(Pkg, a, i, n) { +# print "=== depinst2 " Pkg n=split(tb_DEPS[Pkg],a,",") for (i=1; i<=n; i++) { if (tb_DEP_TRT[a[i]]==0) { tb_DEP_TRT[a[i]]++ if (a[i] in tb_DEPS) depinst2(a[i]) - if (!(a[i] in tb_DB)) + if (!(a[i] in tb_DB)) { +# print "=== install2_update2 F: " a[i] install2_update2(a[i], "") + } } } - install2_update2(Pkg, "") + if (!(Pkg in tb_DB)) { +# print "=== install2_update2 Z: " Pkg + install2_update2(Pkg, "") + } } @@ -214,24 +224,23 @@ function diff( a, i, n, pak) } -function download(pak, a, WEBREPO, fnPak, cmd, rep, pakw) +function download(pak, a, WEBREPO, fnPak, cmd, rc, pakw) { split(pak,a,"#") WEBREPO = tb_WEBDIR[a[1]] fnPak = tb_PKGDIR[a[1]] pak -# cmd="if [ -f " fnPak" ]; then echo n; else echo y; fi" -# cmd | getline rep -# if (rep=="y") { - if ((getline < fnPak) <0) { + if ((getline < fnPak) <=0) { pakw = pak sub("#", "%23", pakw) - cmd="wget --no-directories --tries=3 --waitretry=3 -O "fnPak " " WEBREPO pakw + cmd="wget --no-directories --tries=3 --waitretry=3 -nv --directory-prefix="tb_PKGDIR[a[1]] " " WEBREPO pakw if ("--dry" in tb_OPT) { print "\033[1;34m" cmd "\033[1;0m" } else { - while ((cmd | getline) > 0) - print - close(cmd) + rc=system(cmd) + if (rc>0) { + print "ERREUR", rc + exit 1 + } if (!("-im" in tb_OPT)) verif_md5sum(tb_PKGDIR[a[1]], pak) } @@ -332,8 +341,12 @@ function info( a, b, c, cmd, g, gline, n, rline, out) function install( i) { verif_if_root() - load_DB() load_REPO() + if (!(PKG in tb_REPO)) { + print _"Paquet" " " _"indisponible" ": "PKG + exit 1 + } + load_DB() for (i=1; i<=nPKG; i++) { if (tb_PKG[i] in tb_DB) print _"Le paquet" " " tb_PKG[i] " " _"est déjà installé" @@ -678,7 +691,7 @@ function search( j, FILE, old_FS) } -function sync( cmd, i, j, pak) +function sync( cmd, i, j, pak, rc) { verif_if_root() pak[1]="PKGREPO" @@ -693,9 +706,11 @@ function sync( cmd, i, j, pak) if ("--dry" in tb_OPT) { print "\033[1;34m" cmd "\033[1;0m" } else { - while ((cmd | getline) >0) - print - close(cmd) + rc=system(cmd) + if (rc>0) { + print "ERREUR", rc + exit 1 + } } } } @@ -758,24 +773,25 @@ function verif_if_root( cmd) } -function verif_md5sum(dir, pk, cmd, md5, a) +function verif_md5sum(dir, pk, cmd, md5, a, rep) { cmd="md5sum " dir pk cmd | getline split($0,md5," ") close(cmd) - split(pak,a,"#") + split(pk,a,"#") if (md5[1]!=tb_MD5[a[1]]) { - print "=======> " _"ERREUR" ": " _"md5sum erroné pour " a[1] + print "-------> " _"ERREUR" ": " _"md5sum erroné pour " a[1] print _"requis" ": " tb_MD5[a[1]] print _"trouvé" ": " md5[1] - if ((getline < fnPak) >= 0) { - cmd = "rm " fnPak + print "Supprimer " dir pk " ?" + getline rep + if (rep=="y") { + cmd = "rm " dir pk while ((cmd | getline) > 0) print close(cmd) } - close(fnPak) exit 1 } } diff --git a/base/pkg-get-awk/pkg-get.po b/base/pkg-get-awk/pkg-get.po index 6b1f82006..0230e2019 100644 --- a/base/pkg-get-awk/pkg-get.po +++ b/base/pkg-get-awk/pkg-get.po @@ -122,7 +122,7 @@ msgid "D\303\251sol\303\251, fonction" msgstr "Sorry, function" msgid "indisponible" -msgstr "unavalable" +msgstr "unavailable" msgid "Usage" msgstr "Usage" diff --git a/base/pkg-get-awk/post-install b/base/pkg-get-awk/post-install deleted file mode 100755 index 249cbf8fc..000000000 --- a/base/pkg-get-awk/post-install +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -pkf=/usr/bin/pkg-get -syn=/usr/bin/syn -if [ -L $pkf ]; then - rm $pkf -else - file $pkf | grep perl >/dev/null - if [ $? -eq 0 ]; then - 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 - -- cgit v1.2.3-70-g09d2