* updated krdc (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / package / base / stone / stone_mod_packages.sh
blobd9e681069ae98337041de3e266fba233f8ff830b
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/*/stone/stone_mod_packages.sh
5 # Copyright (C) 2004 - 2021 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
7 #
8 # More information can be found in the files COPYING and README.
9 #
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 ---
16 # [MAIN] 90 packages Package Management (Install, Update and Remove)
18 if [ -n "$ROCK_INSTALL_SOURCE_DEV" ] ; then
19 dev="$ROCK_INSTALL_SOURCE_DEV"
20 dir="/media" ; root="/mnt"
21 gasguiopt="-F"
23 SDECFG_SHORTID="Automatically choose first"
24 elif [ -n "$ROCK_INSTALL_SOURCE_URL" ] ; then
25 dev="NETWORK INSTALL"
26 dir="$ROCK_INSTALL_SOURCE_URL" ; root="/mnt"
27 gasguiopt="-F"
29 SDECFG_SHORTID="$( grep '^export SDECFG_SHORTID=' \
30 /etc/SDE-CONFIG/config 2> /dev/null | cut -f2- -d= )"
31 SDECFG_SHORTID="${SDECFG_SHORTID//\'/}"
32 else
33 dev="/dev/cdrom"
34 dir="/media/cdrom" ; root="/"
35 gasguiopt=""
37 SDECFG_SHORTID="$( grep '^export SDECFG_SHORTID=' \
38 /etc/SDE-CONFIG/config 2> /dev/null | cut -f2- -d= )"
39 SDECFG_SHORTID="${SDECFG_SHORTID//\'/}"
42 read_ids() {
43 mnt="`mktemp`"
44 rm -f $mnt ; mkdir $mnt
46 cmd="$cmd '' ''"
48 if mount $opt $dev $mnt ; then
49 for x in `cd $mnt; ls -d */{,TOOLCHAIN/}pkgs 2> /dev/null | sed -e 's,/pkgs$,,'`
51 cmd="$cmd '$x' 'SDECFG_SHORTID=\"$x\"'"
52 done
53 umount $mnt
54 else
55 cmd="$cmd 'The medium could not be mounted!' ''"
58 rmdir $mnt
61 startgas() {
62 [ -z "$( cd $dir; ls )" ] && mount $opt -v -o ro $dev $dir
63 if [ "$SDECFG_SHORTID" = "Automatically choose first" ]; then
64 SDECFG_SHORTID="$( cd $dir; ls -d */{,TOOLCHAIN/}pkgs 2> /dev/null | \
65 sed -e 's,/pkgs$,,' | head -n 1 )"
66 echo "Using Config-ID <${SDECFG_SHORTID:-None}> .."
68 SDECFG_PKGFILE_TYPE="$(grep '^export SDECFG_PKGFILE_TYPE=' \
69 /etc/SDE-CONFIG/config 2> /dev/null | cut -f2- -d=)"
70 SDECFG_PKGFILE_TYPE="${SDECFG_PKGFILE_TYPE//\'/}"
71 if [ $startgas = 1 ] ; then
72 echo
73 echo "Running: gasgui $gasguiopt \\"
74 echo " -c '$SDECFG_SHORTID' \\"
75 echo " -t '$root' \\"
76 echo " -d '$dev' \\"
77 echo " -s '$dir' \\"
78 echo " -S '$SDECFG_PKGFILE_TYPE'"
79 echo
80 gasgui $gasguiopt -c "$SDECFG_SHORTID" -t "$root" -d "$dev" -s "$dir" -S "$SDECFG_PKGFILE_TYPE"
81 elif [ $startgas = 2 ] ; then
82 echo
83 echo "Running: stone gas main \\"
84 echo " '$SDECFG_SHORTID' \\"
85 echo " '$root' \\"
86 echo " '$dev' \\"
87 echo " '$dir'"
88 $STONE gas main "$SDECFG_SHORTID" "$root" "$dev" "$dir"
92 main() {
93 local startgas=0
94 while : ; do
95 cmd="gui_menu packages 'Package Management
97 Note: You can install, update and remove packages (as well as query
98 package information) with the command-line tool \"mine\". This is just
99 a simple frontend for the \"mine\" program.'"
101 cmd="$cmd 'Mount Options: $opt'"
102 cmd="$cmd 'gui_input \"Mount Options (e.g. -s -o sync) \" \"\$opt\" opt'"
104 cmd="$cmd 'Source Device: $dev'"
105 cmd="$cmd 'gui_input \"Source Device\" \"\$dev\" dev'"
107 cmd="$cmd 'Mountpoint: $dir'"
108 cmd="$cmd 'gui_input \"Mountpoint\" \"\$dir\" dir'"
110 cmd="$cmd 'Config ID: $SDECFG_SHORTID'"
111 cmd="$cmd 'gui_input \"Config ID\""
112 cmd="$cmd \"\$SDECFG_SHORTID\" SDECFG_SHORTID'"
114 read_ids
116 cmd="$cmd '' ''"
117 type -p gasgui > /dev/null &&
118 cmd="$cmd 'Start gasgui Package Manager (recommended)' 'startgas=1'"
119 cmd="$cmd 'Start gastone Package manager (minimal)' 'startgas=2'"
121 if eval "$cmd" ; then
122 if [ $startgas != 0 ]; then
123 startgas $startgas
124 break
126 else
127 break
129 done