Browse Source

Dimitar Zhekov <jimmy@is-vn.bg>:

Changes to sysfiles for better -text and install support.

stone_gui_dialog.sh, stone_gui_text.sh, stone.sh: use type
-p instead of which (the latter does not exist in 2nd stage
small). IMHO, we should prefer type -p to which, because
we depend on bash, which has type -p, and our which is an
alias or a replacement script.

stone_gui_text.sh: instead of "Press ENTER for next page"
on long menus, display a ">>" prompt and read. Valid input
is processed as usual, EOF or invalid input exits to
caller, and ENTER (i.e. an empty line) displays the next
page (as before). The last prompt, ">", remains unchanged.

stone_gui_text.sh: clear the input line when a gui_input
is answered with EOF. Currently there is no way to clear
an input line (can't clear clock_rtc, con_blank, ...)

stone_mod_gas.sh: this is gastone, a simple stone-based
package manager. Supports categories and (un)installing
a single package or an entire category. Requires gzip.

stone_mod_packages.sh: allow mount options (I use --bind)
and support gastone. Don't Display gasgui if it's missing.

stone_mod_setup.sh: while installing, call set_tmarea()
instead of set_tmzone [it's the new entrypoint for setting
time zone] and call set_vcfont [seems logical - all other
i18n-setting stone stuff is called].


git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@1364 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc
rocklinux
Dimitar Zhekov 21 years ago
parent
commit
c723a1c7c1
7 changed files with 136 additions and 26 deletions
  1. +2
    -1
      Documentation/Developers/CHANGELOG-RENE
  2. +1
    -1
      package/base/sysfiles/stone.sh
  3. +1
    -1
      package/base/sysfiles/stone_gui_dialog.sh
  4. +9
    -9
      package/base/sysfiles/stone_gui_text.sh
  5. +93
    -0
      package/base/sysfiles/stone_mod_gas.sh
  6. +28
    -13
      package/base/sysfiles/stone_mod_packages.sh
  7. +2
    -1
      package/base/sysfiles/stone_mod_setup.sh

+ 2
- 1
Documentation/Developers/CHANGELOG-RENE

@ -13,7 +13,8 @@
- Dimitar Zhekov: fixed mplayer doc copy, enabled mp3x in lame, fixed
xfree86-doc, added xfce4 session manager, fixed cd ; echo,
added new lilo config optionsm, added stone to the
2nd_stage_small incl. further space optimizations
2nd_stage_small incl. further space optimizations, cleanup
of some stone modules and a shell gasgui implementation
*) 2003-09-07 (2.0.0-rc1 - 2.0.0-rc2)

+ 1
- 1
package/base/sysfiles/stone.sh

@ -23,7 +23,7 @@
# --- ROCK-COPYRIGHT-NOTE-END ---
export SETUPD="${SETUPD:-/etc/stone.d}"
if which dialog > /dev/null ; then
if type -p dialog > /dev/null ; then
export SETUPG="${SETUPG:-dialog}"
else
export SETUPG="${SETUPG:-text}"

+ 1
- 1
package/base/sysfiles/stone_gui_dialog.sh

@ -169,7 +169,7 @@ gui_yesno() {
gui_edit() {
# find editor
for x in $EDITOR vi nvi emacs xemacs pico ; do
if which $x > /dev/null
if type -p $x > /dev/null
then xx=$x ; break ; fi
done
if [ "$xx" ] ; then

+ 9
- 9
package/base/sysfiles/stone_gui_text.sh

@ -24,7 +24,7 @@
#
gui_menu() {
echo ; echo "+---" ; echo "$2" | fold -s -70 | sed 's,^,| ,'
echo "+---" ; echo ; shift ; shift ; local nr=1 xnr=1 y
echo "+---" ; echo ; shift ; shift ; local nr=1 xnr=1 y in
while [ $# -ge 2 ] ; do
y="${2#\*}"
@ -41,23 +41,23 @@ gui_menu() {
fi
xnr=$(( $xnr + 1 ))
if [ $(( $xnr % 20 )) -eq 0 -a $# -gt 4 ] ; then
echo
read -p '== Press ENTER for next page =='
echo ; echo -n ">> " ; read in || return 1
[ "$in" ] && break
echo
fi
done
echo ; echo -n "> " ; read nr ; nr="action_$nr"
[ -z "${!nr}" ] && return 1
eval "${!nr}" ; return 0
if [ -z "$in" ] ; then echo ; echo -n "> " ; read in ; fi
in="action_$in" ; [ -z "${!in}" ] && return 1
eval "${!in}" ; return 0
}
# Use: gui_input "Text" "Default" "VarName"
#
gui_input() {
echo ; echo "+---" ; echo "$1" | fold -s -66 | sed 's,^,| ,'
echo "+---" ; echo ; echo -n "[ $2 ] > " ; local tmp ; read tmp
[ -z "$tmp" ] && tmp="$2" ; eval "$3=\"\$tmp\""
echo "+---" ; echo ; echo -n "[ $2 ] > " ; local tmp
read tmp && [ -z "$tmp" ] && tmp="$2" ; eval "$3=\"\$tmp\""
}
# Use: gui_yesno "Text"
@ -95,7 +95,7 @@ gui_message() {
gui_edit() {
# find editor
for x in $EDITOR vi nvi emacs xemacs pico ; do
if which $x > /dev/null
if type -p $x > /dev/null
then xx=$x ; break ; fi
done
if [ "$xx" ] ; then

+ 93
- 0
package/base/sysfiles/stone_mod_gas.sh

@ -0,0 +1,93 @@
# --- 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
}

+ 28
- 13
package/base/sysfiles/stone_mod_packages.sh

@ -53,7 +53,7 @@ read_ids() {
cmd="$cmd '' ''"
if mount $dev $mnt ; then
if mount $opt $dev $mnt ; then
for x in `cd $mnt; ls -d */pkgs | cut -f1 -d/` ; do
cmd="$cmd '$x' 'ROCKCFG_SHORTID=\"$x\"'"
done
@ -66,20 +66,30 @@ read_ids() {
}
startgas() {
[ -z "$( cd $dir; ls )" ] && mount -v -o ro $dev $dir
[ -z "$( cd $dir; ls )" ] && mount $opt -v -o ro $dev $dir
if [ "$ROCKCFG_SHORTID" = "Automatically choose first" ]; then
ROCKCFG_SHORTID="$( cd $dir; ls -d */pkgs | \
cut -f1 -d/ | head -1 )"
echo "Using Config-ID <${ROCKCFG_SHORTID:-None}> .."
fi
echo
echo "Running: gasgui $gasguiopt \\"
echo " -c '$ROCKCFG_SHORTID' \\"
echo " -t '$root' \\"
echo " -d '$dev' \\"
echo " -s '$dir'"
echo
gasgui $gasguiopt -c "$ROCKCFG_SHORTID" -t "$root" -d "$dev" -s "$dir"
if [ $startgas = 1 ] ; then
echo
echo "Running: gasgui $gasguiopt \\"
echo " -c '$ROCKCFG_SHORTID' \\"
echo " -t '$root' \\"
echo " -d '$dev' \\"
echo " -s '$dir'"
echo
gasgui $gasguiopt -c "$ROCKCFG_SHORTID" -t "$root" -d "$dev" -s "$dir"
elif [ $startgas = 2 ] ; then
echo
echo "Running: stone gas main \\"
echo " '$ROCKCFG_SHORTID' \\"
echo " '$root' \\"
echo " '$dev' \\"
echo " '$dir'"
$STONE gas main "$ROCKCFG_SHORTID" "$root" "$dev" "$dir"
fi
}
main() {
@ -91,6 +101,9 @@ Note: You can install, update and remove packages (as well as query
package information) with the command-line tool \"mine\". This is just
a simple frontend for the \"mine\" program.'"
cmd="$cmd 'Mount Options: $opt'"
cmd="$cmd 'gui_input \"Mount Options (e.g. -s -o sync) \" \"\$opt\" opt'"
cmd="$cmd 'Source Device: $dev'"
cmd="$cmd 'gui_input \"Source Device\" \"\$dev\" dev'"
@ -104,11 +117,13 @@ a simple frontend for the \"mine\" program.'"
read_ids
cmd="$cmd '' ''"
cmd="$cmd 'Start Package Manager' 'startgas=1'"
type -p gasgui > /dev/null &&
cmd="$cmd 'Start gasgui Package Manager (recommended)' 'startgas=1'"
cmd="$cmd 'Start gastone Package manager (minimal)' 'startgas=2'"
if eval "$cmd" ; then
if [ $startgas = 1 ]; then
startgas
if [ $startgas != 0 ]; then
startgas $startgas
break
fi
else

+ 2
- 1
package/base/sysfiles/stone_mod_setup.sh

@ -111,9 +111,10 @@ main() {
make_fstab
$STONE general set_keymap
while ! set_rootpw; do :; done
$STONE general set_tmzone
$STONE general set_tmarea
$STONE general set_dtime
$STONE general set_locale
$STONE general set_vcfont
cron.run

Loading…
Cancel
Save