summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/pkg-get-awk/Pkgfile4
-rwxr-xr-xbase/pkg-get-awk/pkg-get.awk139
-rw-r--r--base/pkg-get-awk/pkg-get.po15
3 files changed, 107 insertions, 51 deletions
diff --git a/base/pkg-get-awk/Pkgfile b/base/pkg-get-awk/Pkgfile
index 25cacd217..166c20f61 100644
--- a/base/pkg-get-awk/Pkgfile
+++ b/base/pkg-get-awk/Pkgfile
@@ -5,8 +5,8 @@
# Depends on: gawk
name=pkg-get-awk
-version=0.3.1
-release=4
+version=0.3.2
+release=1
source=(syn pkg-get.awk pkg-get-awk.conf pkg-get.po)
PKGMK_KEEP_LOCALES=yes
diff --git a/base/pkg-get-awk/pkg-get.awk b/base/pkg-get-awk/pkg-get.awk
index f7574c0b2..f2ec5cc48 100755
--- a/base/pkg-get-awk/pkg-get.awk
+++ b/base/pkg-get-awk/pkg-get.awk
@@ -13,17 +13,20 @@ function configs( a, i, k, n, old_FS)
{
n=split(ENVIRON["_"],a,"/")
NPKG = a[n]
- VERSION = "0.3.1"
- DATE = "20110108"
+ VERSION = "0.3.2"
+ DATE = "2011-02-19"
# defauts
CONF = "/etc/pkg-get.conf"
+ VERSFILE = "/var/lib/pkg/nutyx-version"
DB = "/var/lib/pkg/db"
LOCKER = "/var/lib/pkg/pkg-get.locker"
PRE = "n"
POST = "n"
PKGDIR[0] = "/srv/NuTyX/release/"
- WEBDIR[0] = "http://nutyx.meticul.eu/pakxe/x86_64/release/"
+ load_NUTYX_VERSION()
+ "uname -p " | getline ENV; close("uname -p")
+ WEBDIR[0] = "http://nutyx.meticul.eu/" NUTYX_VERSION "/" ENV "/release/"
# arguments
OPER=(ARGC>1) ? ARGV[1] : ""
@@ -78,11 +81,6 @@ function configs( a, i, k, n, old_FS)
}
FS=old_FS
-# for (i=0; i<NPKGDIR; i++) {
-# print " PKGDIR[" i "] = " PKGDIR[i]
-# print " WEBDIR[" i "] = " WEBDIR[i]
-# }
-
# options
if ("-r" in tb_OPT)
AARGS = AARGS " -r " tb_OPT["-r"]
@@ -158,7 +156,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) : ""
@@ -172,11 +170,10 @@ function depinst( i)
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é"
-
- }
- else depinst2(tb_PKG[i])
+ if (tb_PKG[i] in tb_DB)
+ print _"Le paquet" " " tb_PKG[i] " " _"est déjà installé"
+ else
+ depinst2(tb_PKG[i])
}
return rc
}
@@ -191,10 +188,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], "")
+ install2_update2(a[i], "")
}
}
- install2(Pkg, "")
+ install2_update2(Pkg, "")
}
@@ -217,21 +214,26 @@ function diff( a, i, n, pak)
}
-function download(pak, a, cmd, j, pakw, rep, WEBREPO)
+function download(pak, a, WEBREPO, fnPak, cmd, rep, pakw)
{
split(pak,a,"#")
WEBREPO = tb_WEBDIR[a[1]]
- cmd="if [ -f " tb_PKGDIR[a[1]] pak" ]; then echo n; else echo y; fi"
- cmd | getline rep
- if (rep=="y") {
+ 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) {
pakw = pak
sub("#", "%23", pakw)
- cmd="wget --no-directories --tries=3 --waitretry=3 -O "tb_PKGDIR[a[1]] pak " " WEBREPO pakw
+ cmd="wget --no-directories --tries=3 --waitretry=3 -O "fnPak " " WEBREPO pakw
if ("--dry" in tb_OPT) {
print "\033[1;34m" cmd "\033[1;0m"
} else {
- while ((cmd | getline) >0)
+ while ((cmd | getline) > 0)
print
+ close(cmd)
+ if (!("-im" in tb_OPT))
+ verif_md5sum(tb_PKGDIR[a[1]], pak)
}
}
}
@@ -333,37 +335,34 @@ function install( i)
load_DB()
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é"
-
- }
- else install2(tb_PKG[i], " ")
+ if (tb_PKG[i] in tb_DB)
+ print _"Le paquet" " " tb_PKG[i] " " _"est déjà installé"
+ else
+ install2_update2(tb_PKG[i], " ")
}
}
-function install2(Pkg, Oper, cmd, i, pak)
+function install2_update2(Pkg, Oper, cmd, i, pak)
{
- if (tb_REPO[Pkg] != "" ){
- 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
- load_DB()
- if (Pkg in tb_DB) {
- return
- }
- else {
- print _"Installation de" " " Pkg
- if (PRE=="y" && tb_PRE[Pkg]=="yes") { # pre-install
- cmd = "/bin/bash " tb_PKGDIR[Pkg] "/PKGINST " Pkg "_pre_install"
- if ("--dry" in tb_OPT) {
- print "\033[1;33m" cmd "\033[1;0m"
- } else {
- while ((cmd | getline) >0)
- print
- close(cmd)
+## load_DB()
+## if (Pkg in tb_DB)
+## 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 ("--dry" in tb_OPT) {
+ print "\033[1;33m" cmd "\033[1;0m"
+ } else {
+ while ((cmd | getline) >0)
+ print
+ close(cmd)
}
}
cmd = "pkgadd " AARGS " " Oper " " tb_PKGDIR[Pkg] pak # Oper==" " : insert ; Oper=="-u" : update
@@ -384,7 +383,6 @@ function install2(Pkg, Oper, cmd, i, pak)
close(cmd)
}
}
- }
}
@@ -496,6 +494,18 @@ function load_LOCKER()
}
+function load_NUTYX_VERSION( old_FS)
+{
+ old_FS = FS
+ FS = "-"
+ getline < VERSFILE
+ if ($1=="2010") NUTYX_VERSION = "attapu"
+ else if ($1=="2011") NUTYX_VERSION = "pakxe"
+ close(VERSFILE)
+ FS = old_FS
+}
+
+
function load_RDEPS( a, FILE, i, j, n)
{
for (j=0; j<NPKGDIR; j++) {
@@ -503,7 +513,13 @@ function load_RDEPS( a, FILE, i, j, n)
while ((getline < FILE) >0) {
n=split($3, a, ",")
for (i=1; i<=n; i++) {
- tb_RDEPS[a[i]] = (a[i] in tb_RDEPS) ? tb_RDEPS[a[i]] "," $1 : $1
+# tb_RDEPS[a[i]] = (a[i] in tb_RDEPS) ? tb_RDEPS[a[i]] "," $1 : $1
+ if (a[i] in tb_RDEPS) {
+ if (!index(tb_RDEPS[a[i]],$1))
+ tb_RDEPS[a[i]] = tb_RDEPS[a[i]] "," $1
+ } else {
+ tb_RDEPS[a[i]] = $1
+ }
}
}
close(FILE)
@@ -521,6 +537,7 @@ function load_REPO( FILE, j, old_FS)
if (!($1 in tb_REPO)) {
sub(".pkg.tar.xz","",$2)
tb_REPO[$1] = $2
+ tb_MD5[$1] = $4
tb_PRE[$1] = $6
tb_POST[$1] = $7
tb_READ[$1] = $8
@@ -717,10 +734,11 @@ function update( i)
verif_if_root()
load_LOCKER()
load_REPO()
+ load_DB() ##
for (i=1; i<=nPKG; i++) {
if (!(tb_PKG[i] in tb_LOCK)) {
print _"paquet à mettre à jour:" " " tb_PKG[i]
- install2(tb_PKG[i], "-u")
+ install2_update2(tb_PKG[i], "-u")
}
}
}
@@ -740,6 +758,29 @@ function verif_if_root( cmd)
}
+function verif_md5sum(dir, pk, cmd, md5, a)
+{
+ cmd="md5sum " dir pk
+ cmd | getline
+ split($0,md5," ")
+ close(cmd)
+ split(pak,a,"#")
+ if (md5[1]!=tb_MD5[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
+ while ((cmd | getline) > 0)
+ print
+ close(cmd)
+ }
+ close(fnPak)
+ exit 1
+ }
+}
+
+
function version()
{
print NPKG " " VERSION " (" DATE ")"
diff --git a/base/pkg-get-awk/pkg-get.po b/base/pkg-get-awk/pkg-get.po
index 76cf12173..6b1f82006 100644
--- a/base/pkg-get-awk/pkg-get.po
+++ b/base/pkg-get-awk/pkg-get.po
@@ -112,6 +112,9 @@ msgstr "The package"
msgid "est install\303\251"
msgstr "is installed"
+msgid "est déjà install\303\251"
+msgstr "is already installed"
+
msgid "n'est pas install\303\251"
msgstr "isn't installed"
@@ -177,3 +180,15 @@ msgstr "use"
msgid "pour"
msgstr "for"
+
+msgid "ERREUR"
+msgstr "ERROR"
+
+msgid "md5sum erron\303\251 pour "
+msgstr "md5sum mismatching for "
+
+msgid "requis"
+msgstr "required"
+
+msgid "trouv\303\251"
+msgstr "found"