|
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
|
|
#
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
# Please add additional copyright information _after_ the line containing
|
|
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
|
|
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
|
|
#
|
|
# ROCK Linux: rock-src/package/base/sysfiles/stone_mod_gas.sh
|
|
# ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version. A copy of the GNU General Public
|
|
# License can be found at Documentation/COPYING.
|
|
#
|
|
# Many people helped and are helping developing ROCK Linux. Please
|
|
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
|
|
# file for details.
|
|
#
|
|
# --- ROCK-COPYRIGHT-NOTE-END ---
|
|
|
|
select_packages() {
|
|
local namever installed uninstalled
|
|
|
|
for (( ; ; )) ; do
|
|
cmd="gui_menu gastone 'Install/Remove packages: $5
|
|
|
|
Note: any (un)installations are done immediately'"
|
|
|
|
installed=""
|
|
uninstalled=""
|
|
time for (( i=${#pkgs[@]} - 1; i >= 0; i-- )) ; do
|
|
if echo "${cats[$i]}" | grep -q -F "$5" ; then
|
|
namever="${pkgs[$i]}-${vers[$i]}"
|
|
if [ -f $2/var/adm/packages/${pkgs[$i]} ] ; then
|
|
cmd="$cmd '[*] $namever' 'mine -r -R $2 ${pkgs[$i]}'"
|
|
installed="$installed ${pkgs[$i]}"
|
|
elif [ -f "$4/$1/pkgs/$namever.gem" ] ; then
|
|
cmd="$cmd '[ ] $namever' 'mine -i -R $2 $4/$1/pkgs/$namever.gem'"
|
|
uninstalled="$uninstalled $4/$1/pkgs/$namever.gem"
|
|
elif [ -f "$4/$1/pkgs/${pkgs[$i]}.gem" ] ; then
|
|
cmd="$cmd '[ ] $namever' 'mine -i -R $2 $4/$1/pkgs/${pkgs[$i]}.gem'"
|
|
uninstalled="$uninstalled $4/$1/pkgs/${pkgs[$i]}.gem"
|
|
fi
|
|
fi
|
|
done
|
|
[ "$uninstalled$installed" ] && cmd="$cmd '' ''"
|
|
[ "$uninstalled" ] && \
|
|
cmd="$cmd 'Install all packages marked as [ ]' 'mine -i -R $2 $uninstalled'"
|
|
[ "$installed" ] && \
|
|
cmd="$cmd 'Uninstall all packages marked as [*]' 'mine -r -R $2 $installed'"
|
|
|
|
eval "$cmd" || break
|
|
done
|
|
}
|
|
|
|
main() {
|
|
if ! [ -f $4/$1/packages.db ] ; then
|
|
gui_message "gas: package database not accessible."
|
|
return
|
|
fi
|
|
|
|
if ! [ -d $2 ] ; then
|
|
gui_message "gas: target directory not accessible."
|
|
return
|
|
fi
|
|
|
|
declare -a pkgs vers cats
|
|
local a b category
|
|
unset package
|
|
|
|
while read a b ; do
|
|
if [ "$a" = "[C]" ] ; then cats[${#pkgs[@]}]="${cats[${#pkgs[@]}]} $b"
|
|
elif [ "$a" = "[V]" ] ; then vers[${#pkgs[@]}]="$b"
|
|
elif [ -z "$b" ] ; then
|
|
pkgs[${#pkgs[@]}]="$package"
|
|
vers[${#pkgs[@]}]="0.0"
|
|
cats[${#pkgs[@]}]="all/all"
|
|
package="$a"
|
|
else
|
|
gui_message "gas: invalid package database input '$a $b'."
|
|
return
|
|
fi
|
|
done < <( gzip -d < $4/$1/packages.db | grep "^[a-zA-Z0-9_+.-]\+$\|^\[[CV]\]")
|
|
[ "$package" ] && pkgs[${#pkgs[@]}]="$package"
|
|
|
|
category="gui_menu category 'Select category'"
|
|
for i in `echo ${cats[@]} | sed -e 's/ /\n/g' | sort -u` ; do
|
|
category="$category $i 'select_packages $1 $2 $3 $4 $i'"
|
|
done
|
|
while eval "$category" ; do : ; done
|
|
}
|