1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 # T2 SDE: package/.../stone/stone_mod_gas.sh
5 # Copyright (C) 2004 - 2005 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
8 # More information can be found in the files COPYING and README.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
17 local namever installed uninstalled
20 cmd
="gui_menu gastone 'Install/Remove packages: $5
22 Note: any (un)installations are done immediately'"
26 for (( i
=${#pkgs[@]} - 1; i
>= 0; i--
)) ; do
27 if echo "${cats[$i]}" |
grep -q -F "$5" ; then
28 namever
="${pkgs[$i]}-${vers[$i]}"
29 if [ -f $2/var
/adm
/packages
/${pkgs[$i]} ] ; then
30 cmd
="$cmd '[*] $namever' '$packager -r -R $2 ${pkgs[$i]}'"
31 installed
="$installed ${pkgs[$i]}"
32 elif [ -f "$4/$1/pkgs/$namever$ext" ] ; then
33 cmd
="$cmd '[ ] $namever' '$packager -i -R $2 $4/$1/pkgs/$namever$ext'"
34 uninstalled
="$uninstalled $namever$ext"
35 elif [ -f "$4/$1/pkgs/${pkgs[$i]}$ext" ] ; then
36 cmd
="$cmd '[ ] $namever' '$packaher -i -R $2 $4/$1/pkgs/${pkgs[$i]}$ext'"
37 uninstalled
="$uninstalled ${pkgs[$i]}$ext"
41 [ "$uninstalled$installed" ] && cmd
="$cmd '' ''"
42 [ "$uninstalled" ] && \
43 cmd
="$cmd 'Install all packages marked as [ ]' '(cd $4/$1/pkgs ; $packager -i -R $2 $uninstalled)'"
45 cmd
="$cmd 'Uninstall all packages marked as [*]' '$packager -r -R $2 $installed'"
52 if ! [ -f $4/$1/pkgs
/packages.db
] ; then
53 gui_message
"gas: package database not accessible."
58 gui_message
"gas: target directory not accessible."
62 if [ $2 = "${2#/}" ] ; then
63 gui_message
"gas: target directory not absolute."
69 if type -p bize
> /dev
/null
&& ! type -p mine
> /dev
/null
; then
77 declare -a pkgs vers cats
82 if [ "$a" = "[C]" ] ; then cats
[${#pkgs[@]}]="${cats[${#pkgs[@]}]} $b"
83 elif [ "$a" = "[V
]" ] ; then vers[${#pkgs[@]}]="$b"
84 elif [ -z "$b" ] ; then
85 pkgs[${#pkgs[@]}]="$package"
86 vers[${#pkgs[@]}]="0.0"
87 cats[${#pkgs[@]}]="all
/all
"
90 gui_message "gas
: invalid package database input
'$a $b'.
"
93 done < <( gzip -d < $4/$1/pkgs/packages.db | grep "^
[a-zA-Z0-9_
+.
-]\
+$\|^\
[[CV
]\
]")
94 [ "$package" ] && pkgs[${#pkgs[@]}]="$package"
96 category="gui_menu category
'Select category'"
97 for i in `echo ${cats[@]} | sed -e 's/ /\n/g' | sort -u` ; do
98 category="$category $i 'select_packages $1 $2 $3 $4 $i'"
100 while eval "$category" ; do : ; done