summaryrefslogtreecommitdiffstats
path: root/base/pkg-get-awk/pkg-get.awk
diff options
context:
space:
mode:
Diffstat (limited to 'base/pkg-get-awk/pkg-get.awk')
-rwxr-xr-xbase/pkg-get-awk/pkg-get.awk93
1 files changed, 32 insertions, 61 deletions
diff --git a/base/pkg-get-awk/pkg-get.awk b/base/pkg-get-awk/pkg-get.awk
index 4cb30ce2a..d8e526a80 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-03-10"
+ DATE = "2011-03-11"
# defauts
CONF = "/etc/pkg-get.conf"
@@ -42,14 +42,6 @@ function configs( a, i, k, n, old_FS)
tb_PKG[++nPKG]=ARGV[i]
}
-# print "* PKG:"
-# print " OPER = "OPER
-# for (i=1; i<=nPKG; i++)
-# print " PKG[" i "] = " tb_PKG[i]
-# print "* OPT:"
-# for (Opt in tb_OPT)
-# print " " Opt " " tb_OPT[Opt]
-
# divers
cmd="uname -m"
cmd | getline ARCH
@@ -355,21 +347,16 @@ function install( i)
function install2_update2(Pkg, Oper, cmd, i, pak)
{
-###
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)
}
if ("-do" in tb_OPT)
return
-## 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"
@@ -389,9 +376,9 @@ function install2_update2(Pkg, Oper, cmd, i, pak)
print
close(cmd)
}
-###
+
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 ("--dry" in tb_OPT) {
@@ -435,24 +422,13 @@ function list( old_FS, FILE, j, prev)
function listinst( old_FS, old_RS, fl)
{
-# if (PROCINFO["version"]) { # gawk
- old_FS = FS; FS = "\t"
- old_RS = RS; RS = ""
- while (getline < DB)
- print $1
- close(DB)
- FS = old_FS
- RS = old_RS
-# } else { # awka
-# while (getline < DB) {
-# if (fl==0)
-# print $1
-# fl++
-# if (NF==0)
-# fl=0
-# }
-# close(DB)
-# }
+ old_FS = FS; FS = "\t"
+ old_RS = RS; RS = ""
+ while (getline < DB)
+ print $1
+ close(DB)
+ FS = old_FS
+ RS = old_RS
}
@@ -466,26 +442,13 @@ function listlocked()
function load_DB( old_FS, old_RS, fl, pak)
{
-# if (PROCINFO["version"]) { # gawk
- old_FS=FS; FS="\n"
- old_RS=RS; RS=""
- while (getline < DB)
- tb_DB[$1]=$2
- close(DB)
- FS=old_FS
- RS=old_RS
-# } else { # awka
-# while (getline < DB) {
-# if (fl==1)
-# tb_DB[pak]=$1
-# if (fl==0)
-# pak=$1
-# fl++
-# if (NF==0)
-# fl=0
-# }
-# close(DB)
-# }
+ old_FS=FS; FS="\n"
+ old_RS=RS; RS=""
+ while (getline < DB)
+ tb_DB[$1]=$2
+ close(DB)
+ FS=old_FS
+ RS=old_RS
}
@@ -532,7 +495,6 @@ 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
if (a[i] in tb_RDEPS) {
if (!index(tb_RDEPS[a[i]],$1))
tb_RDEPS[a[i]] = tb_RDEPS[a[i]] "," $1
@@ -750,17 +712,26 @@ function unlock( i, n, fl, tb_LCK)
}
-function update( i)
+function update( i, pak)
{
verif_if_root()
load_LOCKER()
load_REPO()
- load_DB() ##
+ load_DB()
for (i=1; i<=nPKG; i++) {
- if (!(tb_PKG[i] in tb_LOCK) && !(tb_PKG[i] in tb_DB)) {
- print _"paquet à mettre à jour:" " " tb_PKG[i]
- install2_update2(tb_PKG[i], "-u")
- }
+ pak = tb_PKG[i]
+ if (pak in tb_LOCK)
+ print pak ": " _"paquet verouillé !"
+ else
+ if (!(pak in tb_DB))
+ print pak ": " _"pas de mise à jour d'un paquet non installé !"
+ else
+ if (tb_DB[pak]==tb_REPO[pak])
+ print pak ": " _"paquet déjà à la dernière version"
+ else {
+ print _"paquet à mettre à jour:" " " pak
+ install2_update2(pak, "-u")
+ }
}
}