From 093770639d574d468648301df05ecf8676e23b75 Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 3 Apr 2011 12:51:25 +0200 Subject: pkg-get, maj 0.3.3-1 --- base/pkg-get/.md5sum.i686 | 2 +- base/pkg-get/.md5sum.x86_64 | 2 +- base/pkg-get/Pkgfile | 8 +-- base/pkg-get/pkg-get.awk | 148 ++++++++++++++++++++++++++++++-------------- 4 files changed, 108 insertions(+), 52 deletions(-) diff --git a/base/pkg-get/.md5sum.i686 b/base/pkg-get/.md5sum.i686 index b86a7301c..0d49d2927 100644 --- a/base/pkg-get/.md5sum.i686 +++ b/base/pkg-get/.md5sum.i686 @@ -1,4 +1,4 @@ 3e833be041e5cb66c747c1d6b9a6258b pkg-get-awk.conf -342244762702ba95327867a4aba29a93 pkg-get.awk +9715fe2efcfe43ff294060f596618a3a pkg-get.awk bf4713f8f6976dd4d2d860fe6b4b03d0 pkg-get.po 4d89f89107b269e1579a7e4a440eddb1 syn diff --git a/base/pkg-get/.md5sum.x86_64 b/base/pkg-get/.md5sum.x86_64 index b86a7301c..0d49d2927 100644 --- a/base/pkg-get/.md5sum.x86_64 +++ b/base/pkg-get/.md5sum.x86_64 @@ -1,4 +1,4 @@ 3e833be041e5cb66c747c1d6b9a6258b pkg-get-awk.conf -342244762702ba95327867a4aba29a93 pkg-get.awk +9715fe2efcfe43ff294060f596618a3a pkg-get.awk bf4713f8f6976dd4d2d860fe6b4b03d0 pkg-get.po 4d89f89107b269e1579a7e4a440eddb1 syn diff --git a/base/pkg-get/Pkgfile b/base/pkg-get/Pkgfile index 35be7e055..f7e47b1f1 100644 --- a/base/pkg-get/Pkgfile +++ b/base/pkg-get/Pkgfile @@ -3,9 +3,9 @@ # Maintainer: NuTyX core team # Packager: guy_ -name=pkg-get -version=0.3.2 -release=3 +name=pkg-get-awk +version=0.3.3 +release=1 source=(syn pkg-get.awk pkg-get-awk.conf pkg-get.po) PKGMK_KEEP_LOCALES=yes @@ -14,7 +14,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 + install -m 755 syn $PKG/usr/bin/syn.awk ln -s pkg-get.awk $PKG/usr/bin/pkg-get mkdir -p $PKG/etc install -m 664 pkg-get-awk.conf $PKG/etc diff --git a/base/pkg-get/pkg-get.awk b/base/pkg-get/pkg-get.awk index d8e526a80..1d0d4bb38 100755 --- a/base/pkg-get/pkg-get.awk +++ b/base/pkg-get/pkg-get.awk @@ -13,8 +13,8 @@ function configs( a, i, k, n, old_FS) { n=split(ENVIRON["_"],a,"/") NPKG = a[n] - VERSION = "0.3.2" - DATE = "2011-03-11" + VERSION = "0.3.3" + DATE = "2011-04-03" # defauts CONF = "/etc/pkg-get.conf" @@ -96,6 +96,22 @@ function configs( a, i, k, n, old_FS) # i18n TEXTDOMAIN = "pkg-get" bindtextdomain("/usr/share/locale") + + # msg + RED=31 + GREEN=32 + YELLOW=33 +# BLUE=34 +# MAGENTA=35 + CYAN=36 +# WHITE=37 + + tbColor["OK"] = GREEN + tbColor["ERR"] = RED + tbColor["INFO"] = CYAN + +# COL = system("exit $(stty size | cut -d' ' -f2)") - 6 + COL = 24 } @@ -221,19 +237,21 @@ function download(pak, a, WEBREPO, fnPak, cmd, rc, pakw) if ((getline < fnPak) <=0) { pakw = pak sub("#", "%23", pakw) - cmd="wget --no-directories --tries=3 --waitretry=3 -nv --directory-prefix="tb_PKGDIR[a[1]] " " WEBREPO pakw + cmd="wget --no-directories --tries=3 --waitretry=3 -nv --directory-prefix="tb_PKGDIR[a[1]] " " WEBREPO pakw " >/dev/null 2>&1" if ("--dry" in tb_OPT) { - print "\033[1;34m" cmd "\033[1;0m" + print " " cmd + return 8 } else { rc=system(cmd) if (rc>0) { - print "ERREUR", rc - exit 1 + return 1 } if (!("-im" in tb_OPT)) verif_md5sum(tb_PKGDIR[a[1]], pak) + return 0 } - } + } else + return 9 } @@ -345,48 +363,71 @@ function install( i) } -function install2_update2(Pkg, Oper, cmd, i, pak) +function install2_update2(Pkg, Oper, cmd, i, pak, rc, st) { + printPkg(Pkg"#"tb_REPO[Pkg]) + if (!(Pkg in tb_REPO)) { print "\033[1;31m" _"Paquet" " " Pkg " " _"indisponible" "\033[1;0m" return } if (tb_REPO[Pkg] != "" ) { pak=Pkg"#"tb_REPO[Pkg] ".pkg.tar.xz" - download(pak) + printOper("Téléchargement") + rc = download(pak) + if (!("--dry" in tb_OPT)) { + if (rc==0) st="OK" + else if (rc==1) st="ERR" + else if (rc==9) st="OLD" + else st="" + printStatus(st) + } } if ("-do" in tb_OPT) return - print _"Installation de" " " Pkg - if (PRE=="y" && tb_PRE[Pkg]=="yes") { # pre-install - cmd = "/bin/bash " tb_PKGDIR[Pkg] "/PKGINST " Pkg "_pre_install" + + if (PRE=="y" && tb_PRE[Pkg]=="yes") { + printOper("Pré-installation") + cmd = "/bin/bash " tb_PKGDIR[Pkg] "PKGINST " Pkg "_pre_install" if ("--dry" in tb_OPT) { - print "\033[1;33m" cmd "\033[1;0m" + print " " cmd } else { - while ((cmd | getline) >0) - print - close(cmd) + rc = system(cmd) +# while ((cmd | getline) >0) +# print +# close(cmd) + st = (rc==0) ? "OK" : "ERR" + printStatus(st) } } + + printOper("Installation") cmd = "pkgadd " AARGS " " Oper " " tb_PKGDIR[Pkg] pak # Oper==" " : insert ; Oper=="-u" : update if ("--dry" in tb_OPT) { - print "\033[1;37m" cmd "\033[1;0m" + print " " cmd } else { - while ((cmd | getline) >0) - print - close(cmd) + rc = system(cmd) +# while ((cmd | getline) >0) +# print +# close(cmd) + st = (rc==0) ? "OK" : "ERR" + printStatus(st) } tb_DB[Pkg]=tb_REPO[Pkg] - if (POST=="y" && tb_POST[Pkg]=="yes") { # post-install - cmd = "/bin/bash " tb_PKGDIR[Pkg] "/PKGINST " Pkg "_post_install" + if (POST=="y" && tb_POST[Pkg]=="yes") { + printOper("Post-installation") + cmd = "/bin/bash " tb_PKGDIR[Pkg] "PKGINST " Pkg "_post_install" if ("--dry" in tb_OPT) { - print "\033[1;33m" cmd "\033[1;0m" + print " " cmd } else { - while ((cmd | getline) >0) - print - close(cmd) + rc = system(cmd) +# while ((cmd | getline) >0) +# print +# close(cmd) + st = (rc==0) ? "OK" : "ERR" + printStatus(st) } } } @@ -559,13 +600,28 @@ function printff() } +function printOper(texte) { + printf " %-" COL-4 "s%s", texte, "..." +} + + +function printPkg(pkg) { + printf "\033[1;%dm%s\033[0m\n", YELLOW, pkg +} + + +function printStatus(status) { + printf "\033[%dG\033[1;%dm%-4s\033[0m\n", COL, tbColor[status], status +} + + function quickdep() { - load_DB() - load_DEPS() - load_REPO() - quickdep2(PKG) - printf ("%s\n",PKG) + load_DB() + load_DEPS() + load_REPO() + quickdep2(PKG) + printf ("%s\n",PKG) } @@ -607,21 +663,21 @@ function quickdiff(Dest, a, i, n, pak) function quickhelp() { - print "\033[1;33m" _"Usage" "\033[1;0m: " NPKG " command [package2 ... packageN] [options]" - print "\033[1;33m" _"Quelques commandes" "\033[1;0m:" - print " sync " _"synchronise avec le dépôt" - print " depinst " _"installe package(s) et ses(leurs) dépendances" - print " info " _"informations concernant le package" - print " sysup " _"met à jour les paquets obsolètes" - print " diff " _"affiche la liste des paquets obsolètes" - print "\033[1;33m" _"Quelques options:" "\033[1;0m" - print " -do " _"télécharge seulement" - print " --install-scripts " _"utilise les scripts install" - print " -r " _"utilise" " " _"pour" " pkgadd" - print "\033[1;33m" _"Examples" "\033[1;0m:" - print " " NPKG " install sqlite pysqlite" - print " " NPKG " help" - print _"Pour d'autres commandes et examples, voir la page de manuel" + print "\033[1;33m" _"Usage" "\033[1;0m: " NPKG " command [package2 ... packageN] [options]" + print "\033[1;33m" _"Quelques commandes" "\033[1;0m:" + print " sync " _"synchronise avec le dépôt" + print " depinst " _"installe package(s) et ses(leurs) dépendances" + print " info " _"informations concernant le package" + print " sysup " _"met à jour les paquets obsolètes" + print " diff " _"affiche la liste des paquets obsolètes" + print "\033[1;33m" _"Quelques options:" "\033[1;0m" + print " -do " _"télécharge seulement" + print " --install-scripts " _"utilise les scripts install" + print " -r " _"utilise" " " _"pour" " pkgadd" + print "\033[1;33m" _"Examples" "\033[1;0m:" + print " " NPKG " install sqlite pysqlite" + print " " NPKG " help" + print _"Pour d'autres commandes et examples, voir la page de manuel" } -- cgit v1.2.3-70-g09d2