@ -0,0 +1,13 @@ |
|||||
|
stone_custmain() { |
||||
|
echo "Installing the stone setup tool ..." |
||||
|
cp -v $confdir/stone.sh $root/usr/sbin/stone |
||||
|
chmod +x $root/usr/sbin/stone |
||||
|
for x in $( cd $confdir ; echo stone_*.sh ) ; do |
||||
|
cp -v $confdir/$x $root/etc/stone.d/${x#stone_} |
||||
|
done |
||||
|
} |
||||
|
|
||||
|
custmain="stone_custmain" |
||||
|
|
||||
|
srctar=none |
||||
|
autoextract=0 |
@ -0,0 +1,42 @@ |
|||||
|
|
||||
|
[COPY] --- ROCK-COPYRIGHT-NOTE-BEGIN --- |
||||
|
[COPY] |
||||
|
[COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
|
[COPY] Please add additional copyright information _after_ the line containing |
||||
|
[COPY] the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by |
||||
|
[COPY] the ./scripts/Create-CopyPatch script. Do not edit this copyright text! |
||||
|
[COPY] |
||||
|
[COPY] ROCK Linux: rock-src/package/base/sysfiles/sysfiles.desc |
||||
|
[COPY] ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf |
||||
|
[COPY] |
||||
|
[COPY] This program is free software; you can redistribute it and/or modify |
||||
|
[COPY] it under the terms of the GNU General Public License as published by |
||||
|
[COPY] the Free Software Foundation; either version 2 of the License, or |
||||
|
[COPY] (at your option) any later version. A copy of the GNU General Public |
||||
|
[COPY] License can be found at Documentation/COPYING. |
||||
|
[COPY] |
||||
|
[COPY] Many people helped and are helping developing ROCK Linux. Please |
||||
|
[COPY] have a look at http://www.rocklinux.org/ and the Documentation/TEAM |
||||
|
[COPY] file for details. |
||||
|
[COPY] |
||||
|
[COPY] --- ROCK-COPYRIGHT-NOTE-END --- |
||||
|
|
||||
|
[I] the ROCK Linux system configuration tool and installer |
||||
|
|
||||
|
[T] stone is a simple configuration tool for common system configuration |
||||
|
[T] tasks. It can be used via text-, dialog- or menu-based interfaces. |
||||
|
[T] It is also the ROCK Linux installer. |
||||
|
|
||||
|
[A] Clifford Wolf <clifford@clifford.at> |
||||
|
[M] Clifford Wolf <clifford@clifford.at> |
||||
|
|
||||
|
[C] base/system |
||||
|
[F] DIETLIBC |
||||
|
[F] CORE |
||||
|
|
||||
|
[L] GPL |
||||
|
[S] Stable |
||||
|
[V] 0000 |
||||
|
[P] X -1-------9 204.200 |
||||
|
|
||||
|
[CV-URL] none |
@ -0,0 +1,71 @@ |
|||||
|
#!/bin/bash |
||||
|
# |
||||
|
# --- 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.sh |
||||
|
# ROCK Linux is Copyright (C) 1998 - 2006 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 --- |
||||
|
|
||||
|
recreate_initrd=0 |
||||
|
export SETUPD="${SETUPD:-/etc/stone.d}" |
||||
|
if type -p dialog > /dev/null ; then |
||||
|
export SETUPG="${SETUPG:-dialog}" |
||||
|
else |
||||
|
export SETUPG="${SETUPG:-text}" |
||||
|
fi |
||||
|
export STONE="`type -p $0`" |
||||
|
|
||||
|
if [ "$1" = "-text" ] ; then SETUPG="text" ; shift ; fi |
||||
|
if [ "$1" = "-dialog" ] ; then SETUPG="dialog" ; shift ; fi |
||||
|
if [ "$1" = "-x11" ] ; then SETUPG="x11" ; shift ; fi |
||||
|
|
||||
|
. ${SETUPD}/gui_${SETUPG}.sh |
||||
|
|
||||
|
if [ "$1" -a -f "${SETUPD}/mod_$1.sh" ] |
||||
|
then |
||||
|
. ${SETUPD}/mod_$1.sh ; shift |
||||
|
if [ -z "$*" ] ; then |
||||
|
main |
||||
|
else |
||||
|
eval "$*" |
||||
|
fi |
||||
|
elif [ "$#" = 0 -a -f ${SETUPD}/default.sh ] |
||||
|
then |
||||
|
. ${SETUPD}/default.sh |
||||
|
elif [ "$#" = 0 ] |
||||
|
then |
||||
|
while |
||||
|
command="gui_menu main 'Main Menu - Select the Subsystem you want to configure'" |
||||
|
while read a b c cmd name ; do |
||||
|
x="'" ; cmd="${cmd//,/ }" |
||||
|
command="$command '${name//$x/$x\\$x$x}'" |
||||
|
command="$command '$STONE ${cmd//$x/$x\\$x$x}'" |
||||
|
done < <( grep -h '^# \[MAIN\] [0-9][0-9] ' \ |
||||
|
$SETUPD/mod_*.sh | sort ) |
||||
|
eval "$command" |
||||
|
do : ; done |
||||
|
else |
||||
|
echo |
||||
|
echo "STONE - Setup Tool ONE - ROCK Linux System Configuration" |
||||
|
echo |
||||
|
echo "Usage: $0 [ -text | -dialog | -x11 ] [ module [ command ] ]" |
||||
|
echo |
||||
|
fi |
||||
|
|
||||
|
[ "${recreate_initrd}" == "1" ] && /sbin/mkinitrd |
@ -0,0 +1,187 @@ |
|||||
|
# --- 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_gui_dialog.sh |
||||
|
# ROCK Linux is Copyright (C) 1998 - 2006 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 --- |
||||
|
# |
||||
|
# Filename: gui_dialog.sh |
||||
|
# Description: |
||||
|
# ============ |
||||
|
# This file provides the gui-functions implemented with |
||||
|
# the use of dialog, i.e. a curses based menu-frontend. |
||||
|
|
||||
|
gui_dialog_lines="$( stty size | cut -d' ' -f1 )" |
||||
|
gui_dialog_columns="$( stty size | cut -d' ' -f2 )" |
||||
|
|
||||
|
gui_dialog_s70=$(( gui_dialog_columns - 10 )) |
||||
|
gui_dialog_s62=$(( gui_dialog_columns - 18 )) |
||||
|
gui_dialog_s15=$(( gui_dialog_lines - 10 )) |
||||
|
|
||||
|
gui_dialog() { |
||||
|
dialog --stdout --title 'STONE - Setup Tool ONE - ROCK Linux System Configuration' "$@" |
||||
|
} |
||||
|
|
||||
|
|
||||
|
# [ the following variables act as staticly declared variables in functions (in |
||||
|
# C), i.e. they keep their content even after return of the certain function |
||||
|
# to be used again and again in this function. ] |
||||
|
# |
||||
|
# Important is to know that an element of `gui_menu_tree_name' corresponds |
||||
|
# to an element of `gui_menu_tree_value' by the same number, i.e. |
||||
|
# gui_menu_tree_value[0] contains the value of gui_menu_tree_name[0] |
||||
|
# |
||||
|
declare -a gui_menu_tree_name |
||||
|
declare -a gui_menu_tree_value |
||||
|
gui_menu_tree_id=-1 |
||||
|
|
||||
|
# Use: gui_menu "ID" "Title" "Text" "Action" [ "Text" "Action" [ .. ] ] |
||||
|
# |
||||
|
gui_menu() { |
||||
|
# `cmd_ar' acts as a kind of mapper between the choosen category |
||||
|
# and the function's/command's name that is responsible for what |
||||
|
# next is to do. This command/function is finally executed. |
||||
|
local -a cmd_ar |
||||
|
|
||||
|
# Although dialog does folding itself, we're forced |
||||
|
# to do it directly, because we need the number of |
||||
|
# lines to compute the size of a widget. |
||||
|
local id="$1" title="$( echo "$2" | fmt -$gui_dialog_s62 )" |
||||
|
local y_text=$( echo "$title" | wc -l ) y_menu=$(( ($#-2) / 2 )) |
||||
|
local nr=1 x="'" y choosen='' ; shift 2 |
||||
|
|
||||
|
[ $(( $y_text + $y_menu )) -gt $gui_dialog_s15 ] && \ |
||||
|
y_menu=$(( gui_dialog_s15 - y_text )) |
||||
|
|
||||
|
if [ $id = main ] ; then local cmd="gui_dialog --cancel-label Exit" |
||||
|
elif [ "$gui_nocancel" = 1 ] ; then cmd="gui_dialog --no-cancel" |
||||
|
else local cmd="gui_dialog --cancel-label Back" ; fi |
||||
|
|
||||
|
# In case of having been in the current menu before (found out by |
||||
|
# checking the current ID for the ones saved in `gui_menu_tree_name[]'), |
||||
|
# make the old item be cursored again. |
||||
|
local default='' count |
||||
|
for (( count=$gui_menu_tree_id; $count >= 0; count-- )) |
||||
|
do |
||||
|
if [ "${gui_menu_tree_name[$count]}" = $id ] ; then |
||||
|
default="${gui_menu_tree_value[$count]}" |
||||
|
gui_menu_tree_id=$(( $count - 1 )) |
||||
|
break |
||||
|
fi |
||||
|
done |
||||
|
|
||||
|
cmd="$cmd --default-item \${default:-1}" |
||||
|
cmd="$cmd --menu '${title//$x/$x\\$x$x}'" |
||||
|
cmd="$cmd $(( $y_text + $y_menu + 6 )) $gui_dialog_s70 $y_menu" |
||||
|
|
||||
|
while [ $# -gt 0 ] ; do |
||||
|
y="${2#\*}" |
||||
|
if [ -z "$default" -a "$y" != "$2" ] ; then |
||||
|
default="$nr" |
||||
|
fi |
||||
|
if [ -z "$y" ] ; then |
||||
|
if [ -z "$1" ] ; then |
||||
|
# this line should become a blank one |
||||
|
cmd="$cmd ' ' ' '" |
||||
|
else |
||||
|
# the purpose of this line is only to |
||||
|
# display additional information about |
||||
|
# the item before |
||||
|
cmd="$cmd '-' '${1//$x/$x\\$x$x}'" |
||||
|
fi |
||||
|
else |
||||
|
cmd="$cmd $nr '${1//$x/$x\\$x$x}'" |
||||
|
cmd_ar[$nr]="$y" |
||||
|
((nr++)) |
||||
|
fi |
||||
|
|
||||
|
shift ; shift |
||||
|
done |
||||
|
|
||||
|
# `choosen' gets the choosen item that represents in fact |
||||
|
# the dereferencer for `cmd_ar'. |
||||
|
choosen="$(eval "$cmd")" |
||||
|
|
||||
|
if [ $? -eq 0 ]; then |
||||
|
# if enter is pressed on an ``additional information line'', |
||||
|
# do nothing. |
||||
|
[ "$choosen" = "-" ] && return 0 |
||||
|
|
||||
|
gui_menu_tree_id=$(( $gui_menu_tree_id + 1 )) |
||||
|
gui_menu_tree_name[$gui_menu_tree_id]=$id |
||||
|
gui_menu_tree_value[$gui_menu_tree_id]=$choosen |
||||
|
|
||||
|
eval "${cmd_ar[$choosen]}" |
||||
|
return 0 |
||||
|
else |
||||
|
return 1 |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
# Use: gui_input "Text" "Default" "VarName" |
||||
|
# |
||||
|
gui_input() { |
||||
|
local headlines="$( echo "$1" | fmt -$gui_dialog_s62 )" \ |
||||
|
height=$(( $(echo "$headlines" | wc -l) + 7 )) tmp cmd |
||||
|
|
||||
|
if [ "$gui_nocancel" = 1 ] ; then cmd="gui_dialog --no-cancel" |
||||
|
else local cmd="gui_dialog --cancel-label Back" ; fi |
||||
|
|
||||
|
if tmp="$($cmd --inputbox "$headlines" $height $gui_dialog_s70 "$2")"; then |
||||
|
eval "$3='$tmp'" |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
# Use: gui_message "Text" |
||||
|
# |
||||
|
gui_message() { |
||||
|
local headlines="$( echo "$1" | fold -w $gui_dialog_s62 )" |
||||
|
gui_dialog --msgbox "$headlines" \ |
||||
|
$(( $( echo "$headlines" | wc -l ) + 5 )) $gui_dialog_s70 |
||||
|
} |
||||
|
|
||||
|
# Use: gui_yesno "Text" |
||||
|
# |
||||
|
gui_yesno() { |
||||
|
local headlines="$( echo "$1" | fmt -$gui_dialog_s62 )" |
||||
|
gui_dialog --yesno "$headlines" \ |
||||
|
$(( $( echo "$headlines" | wc -l ) + 4 )) $gui_dialog_s70 |
||||
|
} |
||||
|
|
||||
|
|
||||
|
# Use: gui_edit "Text" "File" |
||||
|
# |
||||
|
gui_edit() { |
||||
|
# find editor |
||||
|
for x in $EDITOR vi nvi emacs xemacs pico ; do |
||||
|
if type -p $x > /dev/null |
||||
|
then xx=$x ; break ; fi |
||||
|
done |
||||
|
if [ "$xx" ] ; then |
||||
|
eval "$xx $2" |
||||
|
else |
||||
|
gui_message "Cannot find any editor. Make sure \$EDITOR is set." |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
# Use: gui_cmd "Title" "Command" |
||||
|
# (Title isn't used in this GUI type) |
||||
|
gui_cmd() { |
||||
|
shift ; eval "$@" |
||||
|
read -p "Press ENTER to continue." |
||||
|
} |
@ -0,0 +1,115 @@ |
|||||
|
# --- 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_gui_text.sh |
||||
|
# ROCK Linux is Copyright (C) 1998 - 2006 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 --- |
||||
|
|
||||
|
# Use: gui_menu "ID" "Title" "Text" "Action" [ "Text" "Action" [ .. ] ] |
||||
|
# |
||||
|
gui_menu() { |
||||
|
echo ; echo "+---" ; echo "$2" | fold -s -w70 | sed 's,^,| ,' |
||||
|
echo "+---" ; echo ; shift ; shift ; local nr=1 xnr=1 y in |
||||
|
|
||||
|
while [ $# -ge 2 ] ; do |
||||
|
y="${2#\*}" |
||||
|
if [ -z "$y" ] ; then |
||||
|
if [ -z "$1" ] ; then |
||||
|
echo " $1" ; shift ; shift |
||||
|
else |
||||
|
echo " - $1" ; shift ; shift |
||||
|
fi |
||||
|
else |
||||
|
printf '%5d. %s\n' "$nr" "$1" |
||||
|
eval "local action_$nr=\"\$y\"" |
||||
|
nr=$(( $nr + 1 )) ; shift ; shift |
||||
|
fi |
||||
|
xnr=$(( $xnr + 1 )) |
||||
|
if [ $(( $xnr % 20 )) -eq 0 -a $# -gt 4 ] ; then |
||||
|
echo ; echo -n ">> " ; read in || return 1 |
||||
|
[ "$in" ] && break |
||||
|
echo |
||||
|
fi |
||||
|
done |
||||
|
|
||||
|
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 -w66 | sed 's,^,| ,' |
||||
|
echo "+---" ; echo ; echo -n "[ $2 ] > " ; local tmp |
||||
|
read tmp && [ -z "$tmp" ] && tmp="$2" ; eval "$3=\"\$tmp\"" |
||||
|
} |
||||
|
|
||||
|
# Use: gui_yesno "Text" |
||||
|
# |
||||
|
# [returns 0 if yes, 1 if no] |
||||
|
gui_yesno() { |
||||
|
local input y="[y]" n=" n " |
||||
|
|
||||
|
echo ; echo "+---"; echo "$1" | fold -s -w66 | sed 's,^,| ,' |
||||
|
echo "+---" ; echo |
||||
|
|
||||
|
while :; do |
||||
|
echo -en "\r? $y\t$n" |
||||
|
read -sr -n 1 input |
||||
|
|
||||
|
if [ "$input" = "" ]; then break |
||||
|
elif [ "$input" = "y" ]; then y="[y]"; n=" n " |
||||
|
elif [ "$input" = "n" ]; then y=" y "; n="[n]" |
||||
|
fi |
||||
|
done |
||||
|
|
||||
|
[ "$input" = "[y]" ] && return 0 |
||||
|
return 1 |
||||
|
} |
||||
|
|
||||
|
# Use: gui_message "Text" |
||||
|
# |
||||
|
gui_message() { |
||||
|
echo ; echo "+---" ; echo "$1" | fold -s -w66 | sed 's,^,| ,' |
||||
|
echo "+---" ; echo ; echo "== Press ENTER to continue ==" ; read |
||||
|
} |
||||
|
|
||||
|
# Use: gui_edit "Text" "File" |
||||
|
# |
||||
|
gui_edit() { |
||||
|
# find editor |
||||
|
for x in $EDITOR vi nvi emacs xemacs pico ; do |
||||
|
if type -p $x > /dev/null |
||||
|
then xx=$x ; break ; fi |
||||
|
done |
||||
|
if [ "$xx" ] ; then |
||||
|
eval "$xx $2" |
||||
|
else |
||||
|
gui_message "Cannot find any editor. Make sure \$EDITOR is set." |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
# Use: gui_cmd "Title" "Command" |
||||
|
# |
||||
|
gui_cmd() { |
||||
|
shift ; eval "$@" |
||||
|
read -p "Press ENTER to continue." |
||||
|
} |
||||
|
|
||||
|
|
@ -0,0 +1,56 @@ |
|||||
|
# --- 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_gui_x11.sh |
||||
|
# ROCK Linux is Copyright (C) 1998 - 2006 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 --- |
||||
|
|
||||
|
if ! Xdialog --infobox 'Test' 0 0 1 ; then |
||||
|
echo |
||||
|
echo "Fatal ERROR: Can't display Xdialog windows!" |
||||
|
echo |
||||
|
echo "Maybe the \$DISPLAY variable is not set or you don't have" |
||||
|
echo "permissions to connect to the X-Server." |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
. ${SETUPD}/gui_dialog.sh |
||||
|
|
||||
|
gui_dialog() { |
||||
|
Xdialog --stdout --title 'STONE - Setup Tool ONE - ROCK Linux System Configuration' "$@" |
||||
|
} |
||||
|
|
||||
|
gui_edit() { |
||||
|
# find editor |
||||
|
for x in $EDITOR vi nvi emacs xemacs pico ; do |
||||
|
if which $x > /dev/null |
||||
|
then xx=$x ; break ; fi |
||||
|
done |
||||
|
if [ "$xx" ] ; then |
||||
|
xterm -T "STONE - $1" -n "STONE" -e bash -c "$xx $2" |
||||
|
else |
||||
|
gui_message "Cannot find any editor. Make sure \$EDITOR is set." |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
gui_cmd() { |
||||
|
title="$1" ; shift |
||||
|
xterm -T "STONE - $title" -n "STONE" -e bash -c "$@ |
||||
|
read -p 'Press ENTER to continue'" |
||||
|
} |
||||
|
|
@ -0,0 +1,108 @@ |
|||||
|
# --- 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 - 2006 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="" |
||||
|
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' '$packager -r -R $2 ${pkgs[$i]}'" |
||||
|
installed="$installed ${pkgs[$i]}" |
||||
|
elif [ -f "$4/$1/pkgs/$namever$ext" ] ; then |
||||
|
cmd="$cmd '[ ] $namever' '$packager -i -R $2 $4/$1/pkgs/$namever$ext'" |
||||
|
uninstalled="$uninstalled $namever$ext" |
||||
|
elif [ -f "$4/$1/pkgs/${pkgs[$i]}$ext" ] ; then |
||||
|
cmd="$cmd '[ ] $namever' '$packaher -i -R $2 $4/$1/pkgs/${pkgs[$i]}$ext'" |
||||
|
uninstalled="$uninstalled ${pkgs[$i]}$ext" |
||||
|
fi |
||||
|
fi |
||||
|
done |
||||
|
[ "$uninstalled$installed" ] && cmd="$cmd '' ''" |
||||
|
[ "$uninstalled" ] && \ |
||||
|
cmd="$cmd 'Install all packages marked as [ ]' '(cd $4/$1/pkgs ; $packager -i -R $2 $uninstalled)'" |
||||
|
[ "$installed" ] && \ |
||||
|
cmd="$cmd 'Uninstall all packages marked as [*]' '$packager -r -R $2 $installed'" |
||||
|
|
||||
|
eval "$cmd" || break |
||||
|
done |
||||
|
} |
||||
|
|
||||
|
main() { |
||||
|
if ! [ -f $4/$1/pkgs/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 |
||||
|
|
||||
|
if [ $2 = "${2#/}" ] ; then |
||||
|
gui_message "gas: target directory not absolute." |
||||
|
return |
||||
|
fi |
||||
|
|
||||
|
local packager ext |
||||
|
|
||||
|
if type -p bize > /dev/null && ! type -p mine > /dev/null ; then |
||||
|
packager=bize |
||||
|
ext=.tar.bz2 |
||||
|
else |
||||
|
packager=mine |
||||
|
ext=.gem |
||||
|
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/pkgs/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 |
||||
|
} |
@ -0,0 +1,215 @@ |
|||||
|
# --- 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_general.sh |
||||
|
# ROCK Linux is Copyright (C) 1998 - 2006 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 --- |
||||
|
# |
||||
|
# [MAIN] 10 general,main Various general system configurations |
||||
|
|
||||
|
set_keymap() { |
||||
|
keymap=$(ls -l /etc/default.keymap 2> /dev/null | sed 's,.*/,,') |
||||
|
[ -z "$keymap" ] && keymap="none" ; keymap="${keymap%.map.gz}" |
||||
|
|
||||
|
case "`uname -m`" in |
||||
|
i*86|x86_64) |
||||
|
mapdir="/usr/share/kbd/keymaps/i386" |
||||
|
;; |
||||
|
ppc) |
||||
|
mapdir="/usr/share/kbd/keymaps/mac" # ppc is a symlink |
||||
|
;; |
||||
|
sparc*) |
||||
|
mapdir="/usr/share/kbd/keymaps/sun" |
||||
|
;; |
||||
|
*) |
||||
|
gui_message "Can't auto-detect your architecture and so I can't find the right /usr/share/kbd/keymaps sub-directory for your system. Sorry." |
||||
|
return |
||||
|
;; |
||||
|
esac |
||||
|
|
||||
|
cmd="gui_menu 'general_keymap' 'Select one of the" |
||||
|
cmd="$cmd following keyboard mappings. (Current: $keymap)'" |
||||
|
cmd="$cmd 'none (kernel defaults)' 'rm -f /etc/default.keymap ; loadkeys defkeymap'" |
||||
|
|
||||
|
cmd="$cmd $( find $mapdir -type f ! -path '*/include/*' -name '*.map.gz' -printf '%P\n' | sed 's,\(.*\)/\(.*\).map.gz$,"\2 (\1)" "ln -sf '$mapdir'/& /etc/default.keymap ; loadkeys \1/\2.map.gz",' | expand -t30 | sort | tr '\n' ' ')" |
||||
|
|
||||
|
eval "$cmd" |
||||
|
} |
||||
|
|
||||
|
set_vcfont() { |
||||
|
vcfont=$(ls -l /etc/default.vcfont 2> /dev/null | sed 's,.*/,,') |
||||
|
if [ -z "$vcfont" ] ; then vcfont="none" |
||||
|
else vcfont="`echo $vcfont | sed -e "s,\.\(fnt\|psf.*\)\.gz$,,"`" ; fi |
||||
|
fontdir="/usr/share/kbd/consolefonts" |
||||
|
|
||||
|
cmd="gui_menu 'general_vcfont' 'Select one of the" |
||||
|
cmd="$cmd following console fonts. (Current: $vcfont)'" |
||||
|
cmd="$cmd 'none (kernel defaults)' 'rm -f /etc/default.vcfont ; setfont'" |
||||
|
|
||||
|
cmd="$cmd $( find $fontdir -type f \( -name '*.fnt.gz' -or -name '*.psf*.gz' \) -printf '%P\n' | sed 's,\(.*\).\(fnt\|psf.*\)\.gz$,"\1" "ln -sf '$fontdir'/& /etc/default.vcfont ; setfont \1",' | expand -t30 | sort | tr '\n' ' ')" |
||||
|
|
||||
|
eval "$cmd" |
||||
|
} |
||||
|
|
||||
|
store_kbd(){ |
||||
|
if [ -f /etc/conf/kbd ] ; then |
||||
|
sed -e "s/kbd_rate=.*/kbd_rate=$kbd_rate/" \ |
||||
|
-e "s/kbd_delay=.*/kbd_delay=$kbd_delay/" < /etc/conf/kbd \ |
||||
|
> /etc/conf/kbd.tmp |
||||
|
grep -q kbd_rate= /etc/conf/kbd.tmp || echo kbd_rate=$kbd_rate \ |
||||
|
>> /etc/conf/kbd.tmp |
||||
|
grep -q kbd_delay= /etc/conf/kbd.tmp || echo kbd_delay=$kbd_delay \ |
||||
|
>> /etc/conf/kbd.tmp |
||||
|
mv /etc/conf/kbd.tmp /etc/conf/kbd |
||||
|
else |
||||
|
echo -e "kbd_rate=$kbd_rate\nkbd_delay=$kbd_delay\n" \ |
||||
|
> /etc/conf/kbd |
||||
|
fi |
||||
|
[ "$kbd_rate" -a "$kbd_delay" ] && kbdrate -r $kbd_rate -d $kbd_delay |
||||
|
} |
||||
|
|
||||
|
set_kbd_rate() { |
||||
|
gui_input "Set new console keyboard auto-repeat rate" \ |
||||
|
"$kbd_rate" "kbd_rate" |
||||
|
store_kbd |
||||
|
} |
||||
|
|
||||
|
set_kbd_delay() { |
||||
|
gui_input "Set new console keyboard auto-repeat delay" \ |
||||
|
"$kbd_delay" "kbd_delay" |
||||
|
store_kbd |
||||
|
} |
||||
|
|
||||
|
store_con(){ |
||||
|
if [ -f /etc/conf/console ] ; then |
||||
|
sed -e "s/con_term=.*/con_term=$con_term/" \ |
||||
|
-e "s/con_blank=.*/con_blank=$con_blank/" \ |
||||
|
< /etc/conf/console > /etc/conf/console.tmp |
||||
|
grep -q con_term= /etc/conf/console.tmp || \ |
||||
|
echo con_term=$con_term >> /etc/conf/console.tmp |
||||
|
grep -q con_blank= /etc/conf/console.tmp || \ |
||||
|
echo con_blank=$con_blank >> /etc/conf/console.tmp |
||||
|
mv /etc/conf/console.tmp /etc/conf/console |
||||
|
else |
||||
|
echo -e "con_term=$con_term\ncon_blank=$con_blank\n" \ |
||||
|
> /etc/conf/console |
||||
|
fi |
||||
|
[ "$con_term" -a "$con_blank" ] && \ |
||||
|
setterm -term $con_term -blank $con_blank > /dev/console |
||||
|
} |
||||
|
|
||||
|
set_con_term() { |
||||
|
gui_input "Set new console screen terminal type" \ |
||||
|
"$con_term" "con_term" |
||||
|
store_con |
||||
|
} |
||||
|
|
||||
|
set_con_blank() { |
||||
|
gui_input "Set new console screen blank interval" \ |
||||
|
"$con_blank" "con_blank" |
||||
|
store_con |
||||
|
} |
||||
|
|
||||
|
set_tmzone() { |
||||
|
tz="$( ls -l /etc/localtime | cut -f8 -d/ )" |
||||
|
cmd="gui_menu 'general_tmzone' 'Select one of the" |
||||
|
cmd="$cmd following time zones. (Current: $tz)'" |
||||
|
|
||||
|
cmd="$cmd $( grep "$1/" /usr/share/zoneinfo/zone.tab | cut -f3 | \ |
||||
|
cut -f2 -d/ | sort -u | tr '\n' ' ' | sed 's,[^ ]\+,& '` |
||||
|
`'"ln -sf ../usr/share/zoneinfo/$1/& /etc/localtime",g' )" |
||||
|
|
||||
|
eval "$cmd" |
||||
|
} |
||||
|
|
||||
|
set_tmarea() { |
||||
|
tz="$( ls -l /etc/localtime | cut -f7 -d/ )" |
||||
|
cmd="gui_menu 'general_tmarea' 'Select one of the" |
||||
|
cmd="$cmd following time areas. (Current: $tz)'" |
||||
|
|
||||
|
cmd="$cmd $( grep '^[^#]' /usr/share/zoneinfo/zone.tab | cut -f3 | \ |
||||
|
cut -f1 -d/ | sort -u | tr '\n' ' ' | sed 's,[^ ]\+,& '` |
||||
|
`'"if set_tmzone & ; then tzset=1 ; fi",g' )" |
||||
|
|
||||
|
tzset=0 |
||||
|
while eval "$cmd" && [ $tzset = 0 ] ; do : ; done |
||||
|
} |
||||
|
|
||||
|
set_dtime() { |
||||
|
dtime="`date '+%m-%d %H:%M %Y'`" ; newdtime="$dtime" |
||||
|
[ -f /etc/conf/clock ] && . /etc/conf/clock |
||||
|
[ "$clock_tz" != localtime ] && clock_tz=utc |
||||
|
gui_input "Set new date and time (MM-DD hh:mm YYYY, $clock_tz)" \ |
||||
|
"$dtime" "newdtime" |
||||
|
if [ "$dtime" != "$newdtime" ] ; then |
||||
|
echo "Setting new date and time ($newdtime) ..." |
||||
|
date "$( echo $newdtime | sed 's,[^0-9],,g' )" |
||||
|
hwclock --systohc --$clock_tz |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
set_locale_sub() { |
||||
|
rm -f /etc/profile.d/locale |
||||
|
[ "$1" != "none" ] && echo "export LANG='$1'" > /etc/profile.d/locale |
||||
|
} |
||||
|
|
||||
|
set_locale() { |
||||
|
unset LANG ; [ -f /etc/profile.d/locale ] && . /etc/profile.d/locale |
||||
|
locale="${LANG:-none}" ; cmd="gui_menu 'general_locale' 'Select one of the following locales. (Current: $locale)' 'none' 'set_locale_sub none'" |
||||
|
|
||||
|
x="$( echo -e "POSIX\tC" | expand -t52 )" |
||||
|
cmd="$cmd '$x' 'set_locale_sub C' $( |
||||
|
grep -H ^title /usr/share/i18n/locales/* 2> /dev/null | \ |
||||
|
awk -F '"' '{ sub(".*/", "", $1); sub("[\\.:].*", "", $1); '" |
||||
|
printf \" '%-52s%s' 'set_locale_sub %s'\", \$2, \$1, \$1; }" |
||||
|
)" |
||||
|
|
||||
|
eval "$cmd" |
||||
|
} |
||||
|
|
||||
|
main() { |
||||
|
while |
||||
|
unset LANG ; [ -f /etc/profile.d/locale ] && . /etc/profile.d/locale |
||||
|
locale="${LANG:-none}" ; tz="$( ls -l /etc/localtime | cut -f7- -d/ )" |
||||
|
keymap=$(ls -l /etc/default.keymap 2> /dev/null | sed 's,.*/,,') |
||||
|
[ "$keymap" ] || keymap="none" ; keymap="${keymap%.map.gz}" |
||||
|
vcfont=$(ls -l /etc/default.vcfont 2> /dev/null | sed 's,.*/,,') |
||||
|
if [ -z "$vcfont" ] ; then vcfont="none" |
||||
|
else vcfont="`echo $vcfont | sed -e "s,\.\(fnt\|psf.*\)\.gz$,,"`" ; fi |
||||
|
dtime="`date '+%m-%d %H:%M %Y'`" |
||||
|
[ -f /etc/conf/kbd ] && . /etc/conf/kbd |
||||
|
[ "$kbd_rate" ] || kbd_rate=30 |
||||
|
[ "$kbd_delay" ] || kbd_delay=250 |
||||
|
[ -f /etc/conf/console ] && . /etc/conf/console |
||||
|
[ "$con_term" ] || con_term=linux |
||||
|
[ "$con_blank" ] || con_blank=0 |
||||
|
|
||||
|
gui_menu general 'Various general system configurations' \ |
||||
|
"Set console keyboard mapping ....... $keymap" "set_keymap" \ |
||||
|
"Set console screen font ............ $vcfont" "set_vcfont" \ |
||||
|
"Set system-wide time zone .......... $tz" "set_tmarea" \ |
||||
|
"Set date and time (utc/localtime) .. $dtime" "set_dtime" \ |
||||
|
"Set system-wide locale (language) .. $locale" "set_locale" \ |
||||
|
"Set console keyboard repeat rate ... $kbd_rate" "set_kbd_rate" \ |
||||
|
"Set console keyboard repeat delay .. $kbd_delay" "set_kbd_delay" \ |
||||
|
"Set console screen terminal type ... $con_term" "set_con_term" \ |
||||
|
"Set console screen blank interval .. $con_blank" "set_con_blank" \ |
||||
|
"Run the (daily) 'cron.run' script now" "cron.run" |
||||
|
do : ; done |
||||
|
} |
||||
|
|
@ -0,0 +1,245 @@ |
|||||
|
# --- 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_install.sh |
||||
|
# ROCK Linux is Copyright (C) 1998 - 2006 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 --- |
||||
|
|
||||
|
part_mounted_action() { |
||||
|
if gui_yesno "Do you want to un-mount the filesystem on $1/$2?" |
||||
|
then umount /dev/$1/$2; fi |
||||
|
} |
||||
|
|
||||
|
part_swap_action() { |
||||
|
if gui_yesno "Do you want to de-activate the swap space on $1/$2?" |
||||
|
then swapoff /dev/$1/$2; fi |
||||
|
} |
||||
|
|
||||
|
part_mount() { |
||||
|
local dir |
||||
|
gui_input "Mount device $1/$2 on directory |
||||
|
(for example /, /home, /var, ...)" '/' dir |
||||
|
if [ "$dir" ] ; then |
||||
|
dir="$( echo $dir | sed 's,^/*,,; s,/*$,,' )" |
||||
|
if [ -z "$dir" ] || grep -q " /mnt/target " /proc/mounts |
||||
|
then |
||||
|
mkdir -p /mnt/target/$dir |
||||
|
mount /dev/$1/$2 /mnt/target/$dir |
||||
|
else |
||||
|
gui_message "Please mount a root filesystem first." |
||||
|
fi |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
part_mkfs() { |
||||
|
cmd="gui_menu part_mkfs 'Create filesystem on $1/$2'" |
||||
|
|
||||
|
cmd="$cmd 'ext3fs (journaling filesystem)'" |
||||
|
cmd="$cmd 'mke2fs -j /dev/$1/$2'" |
||||
|
|
||||
|
cmd="$cmd 'ext2fs (non-journaling fs)'" |
||||
|
cmd="$cmd 'mke2fs /dev/$1/$2'" |
||||
|
|
||||
|
cmd="$cmd 'reiserfs (journaling filesystem)'" |
||||
|
cmd="$cmd 'mkreiserfs /dev/$1/$2'" |
||||
|
|
||||
|
if type -p jfs_mkfs > /dev/null ; then |
||||
|
cmd="$cmd 'IBM JFS (journaling filesystem)'" |
||||
|
cmd="$cmd 'jfs_mkfs /dev/$1/$2'" |
||||
|
fi |
||||
|
|
||||
|
if type -p mkfs.xfs > /dev/null ; then |
||||
|
cmd="$cmd 'SGI XFS (journaling filesystem)'" |
||||
|
cmd="$cmd 'mkfs.xfs -f /dev/$1/$2'" |
||||
|
fi |
||||
|
|
||||
|
eval "$cmd" && part_mount $1 $2 |
||||
|
} |
||||
|
|
||||
|
part_unmounted_action() { |
||||
|
gui_menu part "$1/$2" \ |
||||
|
"Create a filesystem on the partition" \ |
||||
|
"part_mkfs $1 $2" \ |
||||
|
"Mount an existing filesystem from the partition" \ |
||||
|
"part_mount $1 $2" \ |
||||
|
"Create a swap space on the partition" \ |
||||
|
"mkswap /dev/$1/$2; swapon /dev/$1/$2" \ |
||||
|
"Activate an existing swap space on the partition" \ |
||||
|
"swapon /dev/$1/$2" |
||||
|
} |
||||
|
|
||||
|
part_add() { |
||||
|
local action="unmounted" location="currently not mounted" |
||||
|
if grep -q "^/dev/$1/$2 " /proc/swaps; then |
||||
|
action=swap ; location="swap <no mount point>" |
||||
|
elif grep -q "^/dev/$1/$2 " /proc/mounts; then |
||||
|
action=mounted |
||||
|
location="`grep "^/dev/$1/$2 " /proc/mounts | cut -d ' ' -f 2 | \ |
||||
|
sed "s,^/mnt/target,," `" |
||||
|
[ "$location" ] || location="/" |
||||
|
fi |
||||
|
|
||||
|
# save partition information |
||||
|
disktype /dev/$1/$2 > /tmp/stone-install |
||||
|
type="`grep /tmp/stone-install -v -e '^ ' -e '^Block device' \ |
||||
|
-e '^Partition' -e '^---' | \ |
||||
|
sed -e 's/[,(].*//' -e '/^$/d' -e 's/ $//' | tail -n 1`" |
||||
|
size="`grep 'Block device, size' /tmp/stone-install | \ |
||||
|
sed 's/.* size \(.*\) (.*/\1/'`" |
||||
|
|
||||
|
[ "$type" ] || type="undetected" |
||||
|
cmd="$cmd '`printf "%-6s %-24s %-10s" $2 "$location" "$size"` $type' 'part_${action}_action $1 $2'" |
||||
|
} |
||||
|
|
||||
|
disk_action() { |
||||
|
if grep -q "^/dev/$1/" /proc/swaps /proc/mounts; then |
||||
|
gui_message "Partitions from $1 are currently in use, so you |
||||
|
can't modify this disks partition table." |
||||
|
return |
||||
|
fi |
||||
|
|
||||
|
cmd="gui_menu disk 'Edit partition table of $1'" |
||||
|
for x in cfdisk fdisk pdisk mac-fdisk ; do |
||||
|
fn="" |
||||
|
[ -f /bin/$x ] && fn="/bin/$x" |
||||
|
[ -f /sbin/$x ] && fn="/sbin/$x" |
||||
|
[ -f /usr/bin/$x ] && fn="/usr/bin/$x" |
||||
|
[ -f /usr/sbin/$x ] && fn="/usr/sbin/$x" |
||||
|
[ "$fn" ] && \ |
||||
|
cmd="$cmd \"Edit partition table using '$x'\" \"$x /dev/$1/disc\"" |
||||
|
done |
||||
|
|
||||
|
eval $cmd |
||||
|
} |
||||
|
|
||||
|
vg_action() { |
||||
|
cmd="gui_menu vg 'Volume Group $1'" |
||||
|
|
||||
|
|
||||
|
if [ -e /proc/lvm/VGs/$1 ]; then |
||||
|
cmd="$cmd 'Display attributes of $1' 'gui_cmd \"display $1\" vgdisplay $1'" |
||||
|
|
||||
|
if grep -q "^/dev/$1/" /proc/swaps /proc/mounts; then |
||||
|
cmd="$cmd \"LVs of $1 are currently in use, so you can't |
||||
|
de-activate it.\" ''" |
||||
|
else |
||||
|
cmd="$cmd \"De-activate VG '$1'\" 'vgchange -an $1'" |
||||
|
fi |
||||
|
else |
||||
|
cmd="$cmd 'Display attributes of $1' 'gui_cmd \"display $1\" vgdisplay -D $1'" |
||||
|
|
||||
|
cmd="$cmd \"Activate VG '$1'\" 'vgchange -ay $1'" |
||||
|
fi |
||||
|
|
||||
|
eval $cmd |
||||
|
} |
||||
|
|
||||
|
disk_add() { |
||||
|
local x y=0 |
||||
|
cmd="$cmd 'Edit partition table of $1' 'disk_action $1'" |
||||
|
for x in $( cd /dev/$1 ; ls part* 2> /dev/null ) |
||||
|
do |
||||
|
part_add $1 $x ; y=1 |
||||
|
done |
||||
|
if [ $y = 0 ]; then |
||||
|
cmd="$cmd 'This disks partition table is empty.' ''" |
||||
|
fi |
||||
|
cmd="$cmd '' ''" |
||||
|
} |
||||
|
|
||||
|
vg_add() { |
||||
|
local x y=0 |
||||
|
cmd="$cmd 'Logical volumes of $1:' 'vg_action $1'" |
||||
|
if [ -e /proc/lvm/VGs/$1 ] ; then |
||||
|
for x in $( cd /proc/lvm/VGs/$1/LVs; ls -1 ) |
||||
|
do |
||||
|
part_add $1 $x ; y=1 |
||||
|
done |
||||
|
if [ $y = 0 ]; then |
||||
|
cmd="$cmd 'No logical volumes.' ''" |
||||
|
fi |
||||
|
else |
||||
|
cmd="$cmd 'Volume Group is not active.' ''" |
||||
|
fi |
||||
|
cmd="$cmd '' ''" |
||||
|
} |
||||
|
|
||||
|
main() { |
||||
|
local cmd install_now=0 |
||||
|
while |
||||
|
cmd="gui_menu install 'Partitioning your discs |
||||
|
|
||||
|
This dialog allows you to modify your discs partition layout and to create filesystems and swap space - as well as mounting / activating it. Everything you can do using this tool can also be done manually on the command line.'" |
||||
|
|
||||
|
# protect for the case no discs are present ... |
||||
|
if [ -e /dev/discs ] ; then |
||||
|
for x in $( cd /dev/discs |
||||
|
ls -l */disc | grep ' -> ' | cut -f4- -d/ ; ) |
||||
|
do |
||||
|
disk_add ${x%/disc} |
||||
|
done |
||||
|
for x in $( cat /etc/lvmtab 2> /dev/null ) |
||||
|
do |
||||
|
vg_add "$x" |
||||
|
done |
||||
|
else |
||||
|
cmd="$cmd 'No hard-disc found!' ''" |
||||
|
fi |
||||
|
|
||||
|
cmd="$cmd 'Install the system ...' 'install_now=1'" |
||||
|
|
||||
|
eval "$cmd" && [ "$install_now" -eq 0 ] |
||||
|
do : ; done |
||||
|
|
||||
|
if [ "$install_now" -ne 0 ] ; then |
||||
|
$STONE packages |
||||
|
cat > /mnt/target/tmp/stone_postinst.sh << EOT |
||||
|
#!/bin/sh |
||||
|
mount -v -t proc proc /proc |
||||
|
mount -v -t sysfs sysfs /sys |
||||
|
. /etc/profile |
||||
|
stone setup |
||||
|
umount -v /sys |
||||
|
umount -v /proc |
||||
|
EOT |
||||
|
chmod +x /mnt/target/tmp/stone_postinst.sh |
||||
|
grep ' /mnt/target[/ ]' /proc/mounts | \ |
||||
|
sed 's,/mnt/target/\?,/,' > /mnt/target/etc/mtab |
||||
|
mount --bind /dev /mnt/target/dev |
||||
|
cd /mnt/target ; chroot . ./tmp/stone_postinst.sh |
||||
|
rm -fv ./tmp/stone_postinst.sh |
||||
|
if gui_yesno "Do you want to un-mount the filesystems and reboot now?" |
||||
|
then |
||||
|
cd / |
||||
|
sync |
||||
|
umount -adrv |
||||
|
shutdown -r now |
||||
|
else |
||||
|
echo |
||||
|
echo "You might want to umount all filesystems now and reboot" |
||||
|
echo "the system now using the commands:" |
||||
|
echo |
||||
|
echo " umount -adrv" |
||||
|
echo " reboot -f" |
||||
|
echo |
||||
|
echo "Or by executing 'shutdown -r now' which will run the above commands." |
||||
|
echo |
||||
|
fi |
||||
|
fi |
||||
|
} |
||||
|
|
@ -0,0 +1,116 @@ |
|||||
|
# --- 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_network.sh |
||||
|
# ROCK Linux is Copyright (C) 1998 - 2006 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 --- |
||||
|
# |
||||
|
# [MAIN] 20 network Network Configuration |
||||
|
|
||||
|
set_name() { |
||||
|
old1="$HOSTNAME" old2="$HOSTNAME.$DOMAINNAME" old3="$DOMAINNAME" |
||||
|
if [ $1 = HOSTNAME ] ; then |
||||
|
gui_input "Set a new hostname (without domain part)" \ |
||||
|
"${!1}" "$1" |
||||
|
else |
||||
|
gui_input "Set a new domainname (without host part)" \ |
||||
|
"${!1}" "$1" |
||||
|
fi |
||||
|
new="$HOSTNAME.$DOMAINNAME $HOSTNAME" |
||||
|
|
||||
|
echo "$HOSTNAME" > /etc/HOSTNAME ; hostname "$HOSTNAME" |
||||
|
|
||||
|
#ip="`echo $IPADDR | sed 's,[/ ].*,,'`" |
||||
|
#if grep -q "^$ip\\b" /etc/hosts ; then |
||||
|
# tmp="`mktemp`" |
||||
|
# sed -e "/^$ip\\b/ s,\\b$old2\\b[ ]*,,g" \ |
||||
|
# -e "/^$ip\\b/ s,\\b$old1\\b[ ]*,,g" \ |
||||
|
# -e "/^$ip\\b/ s,[ ]\\+,&$new ," < /etc/hosts > $tmp |
||||
|
# cat $tmp > /etc/hosts ; rm -f $tmp |
||||
|
#else |
||||
|
# echo -e "$ip\\t$new" >> /etc/hosts |
||||
|
#fi |
||||
|
|
||||
|
if [ $1 = DOMAINNAME ] ; then |
||||
|
tmp="`mktemp`" |
||||
|
grep -vx "search $old3" /etc/resolv.conf > $tmp |
||||
|
[ -n "$DOMAINNAME" ] && echo "search $DOMAINNAME" >> $tmp |
||||
|
cat $tmp > /etc/resolv.conf |
||||
|
rm -f $tmp |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
set_dns() { |
||||
|
gui_input "Set a new (space seperated) list of DNS Servers" "$DNSSRV" "DNSSRV" |
||||
|
DNSSRV="`echo $DNSSRV`" ; [ -z "$DNSSRV" ] && DNSSRV="none" |
||||
|
|
||||
|
tmp="`mktemp`" ; grep -v '^nameserver\b' /etc/resolv.conf > $tmp |
||||
|
for x in $DNSSRV ; do |
||||
|
[ "$x" != "none" ] && echo "nameserver $x" >> $tmp |
||||
|
done |
||||
|
cat $tmp > /etc/resolv.conf |
||||
|
rm -f $tmp |
||||
|
} |
||||
|
|
||||
|
HOSTNAME="`hostname`" |
||||
|
DOMAINNAME="`hostname -d 2> /dev/null`" |
||||
|
|
||||
|
tmp="`mktemp`" |
||||
|
grep '^nameserver ' /etc/resolv.conf | tr '\t' ' ' | tr -s ' ' | \ |
||||
|
sed 's,^nameserver *\([^ ]*\),DNSSRV="$DNSSRV \1",' > $tmp |
||||
|
DNSSRV='' ; . $tmp ; DNSSRV="`echo $DNSSRV`" |
||||
|
[ -z "$DNSSRV" ] && DNSSRV="none" ; rm -f $tmp |
||||
|
|
||||
|
main_detailed() { |
||||
|
while |
||||
|
cmd="gui_menu network 'Network Configuration'" |
||||
|
|
||||
|
cmd="$cmd 'Static hostname: $HOSTNAME' 'set_name HOSTNAME'" |
||||
|
cmd="$cmd 'Static domainname: $DOMAINNAME' 'set_name DOMAINNAME'" |
||||
|
cmd="$cmd 'Static DNS-Server: $DNSSRV' 'set_dns' '' ''" |
||||
|
|
||||
|
cmd="$cmd 'Configure runlevels for network service'" |
||||
|
cmd="$cmd '$STONE runlevel edit_srv network'" |
||||
|
cmd="$cmd '(Re-)Start network init script'" |
||||
|
cmd="$cmd '$STONE runlevel restart network'" |
||||
|
cmd="$cmd '' ''" |
||||
|
|
||||
|
cmd="$cmd 'View/Edit /etc/resolv.conf file' 'gui_edit /etc/resolv.conf /etc/resolv.conf'" |
||||
|
cmd="$cmd 'View/Edit /etc/hosts file' 'gui_edit /etc/hosts /etc/hosts'" |
||||
|
cmd="$cmd 'View/Edit /etc/network/config file' 'gui_edit /etc/network/config /etc/network/config'" |
||||
|
|
||||
|
cmd="$cmd '' ''" |
||||
|
|
||||
|
cmd="$cmd 'Read the /etc/network/README file' 'gui_edit /etc/network/README /etc/network/README'" |
||||
|
|
||||
|
eval "$cmd" |
||||
|
do : ; done |
||||
|
} |
||||
|
|
||||
|
main() { |
||||
|
while |
||||
|
cmd="gui_menu network 'Network Configuration'" |
||||
|
|
||||
|
cmd="$cmd 'Just edit /etc/network/config' 'gui_edit /etc/network/config /etc/network/config'" |
||||
|
cmd="$cmd 'Read the /etc/network/README file' 'gui_edit /etc/network/README /etc/network/README'" |
||||
|
cmd="$cmd 'Detailed Networking configuration' 'exec $0 network main_detailed'" |
||||
|
|
||||
|
eval "$cmd" |
||||
|
do : ; done |
||||
|
} |
||||
|
|
@ -0,0 +1,143 @@ |
|||||
|
# --- 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_packages.sh |
||||
|
# ROCK Linux is Copyright (C) 1998 - 2006 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 --- |
||||
|
# |
||||
|
# [MAIN] 90 packages Package Management (Install, Update and Remove) |
||||
|
|
||||
|
if [ -n "$ROCK_INSTALL_SOURCE_DEV" ] ; then |
||||
|
dev="$ROCK_INSTALL_SOURCE_DEV" |
||||
|
dir="/mnt/source" ; root="/mnt/target" |
||||
|
gasguiopt="-F" |
||||
|
|
||||
|
ROCKCFG_SHORTID="Automatically choose first" |
||||
|
elif [ -n "$ROCK_INSTALL_SOURCE_URL" ] ; then |
||||
|
dev="NETWORK INSTALL" |
||||
|
dir="$ROCK_INSTALL_SOURCE_URL" |
||||
|
root="/mnt/target" |
||||
|
gasguiopt="-F" |
||||
|
|
||||
|
ROCKCFG_SHORTID="$( grep '^export ROCKCFG_SHORTID=' \ |
||||
|
/etc/ROCK-CONFIG/config 2> /dev/null | cut -f2- -d= )" |
||||
|
ROCKCFG_SHORTID="${ROCKCFG_SHORTID//\'/}" |
||||
|
|
||||
|
tmpfile=`mktemp` |
||||
|
if wget -q -O "$tmpfile" "${ROCK_INSTALL_SOURCE_URL}/index.txt" ; then |
||||
|
ROCKCFG_SHORTID=`grep -v "${ROCKCFG_SHORTID}" $tmpfile | \ |
||||
|
grep '/pkgs/' | head -n 1 | \ |
||||
|
cut -f2 -d' ' | cut -f1 -d/` |
||||
|
fi ; |
||||
|
rm -f $tmpfile |
||||
|
else |
||||
|
dev="/dev/cdroms/cdrom0" |
||||
|
dir="/mnt/cdrom" ; root="/" |
||||
|
gasguiopt="" |
||||
|
|
||||
|
ROCKCFG_SHORTID="$( grep '^export ROCKCFG_SHORTID=' \ |
||||
|
/etc/ROCK-CONFIG/config 2> /dev/null | cut -f2- -d= )" |
||||
|
ROCKCFG_SHORTID="${ROCKCFG_SHORTID//\'/}" |
||||
|
fi |
||||
|
|
||||
|
read_ids() { |
||||
|
mnt="`mktemp`" |
||||
|
rm -f $mnt ; mkdir $mnt |
||||
|
|
||||
|
cmd="$cmd '' ''" |
||||
|
|
||||
|
if mount $opt $dev $mnt ; then |
||||
|
for x in `cd $mnt; ls -d */{,ROCK/}pkgs 2> /dev/null | sed -e 's,/pkgs$,,'` |
||||
|
do |
||||
|
cmd="$cmd '$x' 'ROCKCFG_SHORTID=\"$x\"'" |
||||
|
done |
||||
|
umount $mnt |
||||
|
else |
||||
|
cmd="$cmd 'The medium could not be mounted!' ''" |
||||
|
fi |
||||
|
|
||||
|
rmdir $mnt |
||||
|
} |
||||
|
|
||||
|
startgas() { |
||||
|
[ -z "$( cd $dir; ls )" ] && mount $opt -v -o ro $dev $dir |
||||
|
if [ "$ROCKCFG_SHORTID" = "Automatically choose first" ]; then |
||||
|
ROCKCFG_SHORTID="$( cd $dir; ls -d */{,ROCK/}pkgs 2> /dev/null | \ |
||||
|
sed -e 's,/pkgs$,,' | head -n 1 )" |
||||
|
echo "Using Config-ID <${ROCKCFG_SHORTID:-None}> .." |
||||
|
fi |
||||
|
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() { |
||||
|
local startgas=0 |
||||
|
while : ; do |
||||
|
cmd="gui_menu packages 'Package Management |
||||
|
|
||||
|
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.'" |
||||
|
|
||||
|
type -p gasgui > /dev/null && |
||||
|
cmd="$cmd 'Start gasgui Package Manager (recommended)' 'startgas=1'" |
||||
|
cmd="$cmd 'Start gastone Package manager (minimal)' 'startgas=2'" |
||||
|
cmd="$cmd '' ''" |
||||
|
|
||||
|
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'" |
||||
|
|
||||
|
cmd="$cmd 'Mountpoint: $dir'" |
||||
|
cmd="$cmd 'gui_input \"Mountpoint\" \"\$dir\" dir'" |
||||
|
|
||||
|
cmd="$cmd 'ROCK Config ID: $ROCKCFG_SHORTID'" |
||||
|
cmd="$cmd 'gui_input \"ROCK Config ID\"" |
||||
|
cmd="$cmd \"\$ROCKCFG_SHORTID\" ROCKCFG_SHORTID'" |
||||
|
|
||||
|
read_ids |
||||
|
|
||||
|
if eval "$cmd" ; then |
||||
|
if [ $startgas != 0 ]; then |
||||
|
startgas $startgas |
||||
|
break |
||||
|
fi |
||||
|
else |
||||
|
break |
||||
|
fi |
||||
|
done |
||||
|
} |
||||
|
|
@ -0,0 +1,130 @@ |
|||||
|
# --- 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_runlevel.sh |
||||
|
# ROCK Linux is Copyright (C) 1998 - 2006 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 --- |
||||
|
# |
||||
|
# [MAIN] 80 runlevel Runlevel Configuration (Services) |
||||
|
|
||||
|
# Remove dead symlinks |
||||
|
for x in /etc/rc.d/rc[0-6].d/* ; do |
||||
|
[ -L "$x" -a ! -e "$x" ] && rm -f "$x" |
||||
|
done |
||||
|
|
||||
|
chrlv() { |
||||
|
local srv=$1 rl=$2 pri=$3 |
||||
|
if [ ! -e /etc/rc.d/rc$rl.d/S??$srv ] |
||||
|
then |
||||
|
ln -sf ../init.d/$srv /etc/rc.d/rc$rl.d/S$pri$srv |
||||
|
kpr=`printf "%02d" $(( 100 - $pri ))` |
||||
|
ln -sf ../init.d/$srv /etc/rc.d/rc$rl.d/K$kpr$srv |
||||
|
else |
||||
|
rm -f /etc/rc.d/rc$rl.d/[SK]??$srv |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
chpri() { |
||||
|
local srv=$1 pri=$2 |
||||
|
|
||||
|
gui_input "Changing priority for service $1" "$pri" pri |
||||
|
|
||||
|
if [ ! -z "${pri#[0-9][0-9]}" ] |
||||
|
then |
||||
|
gui_message "The value you entered is not valid." |
||||
|
return |
||||
|
fi |
||||
|
|
||||
|
rm -f /etc/rc.d/rcX.d/X??$srv |
||||
|
echo "The script '$srv' has the priority $pri." \ |
||||
|
> /etc/rc.d/rcX.d/X$pri$srv |
||||
|
|
||||
|
for x in 0 1 2 3 4 5 6 ; do |
||||
|
if [ -e /etc/rc.d/rc$x.d/S??$srv ] ; then |
||||
|
rm -f /etc/rc.d/rc$x.d/[SK]??$srv |
||||
|
ln -sf ../init.d/$srv /etc/rc.d/rc$x.d/S$pri$srv |
||||
|
kpr=`printf "%02d" $(( 100 - $pri ))` |
||||
|
ln -sf ../init.d/$srv /etc/rc.d/rc$x.d/K$kpr$srv |
||||
|
fi |
||||
|
done |
||||
|
} |
||||
|
|
||||
|
edit_srv() { |
||||
|
local srv=$1 id="runlevel_$RANDOM" cmd="" |
||||
|
|
||||
|
while |
||||
|
cmd="gui_menu $id 'Runlevel Editor - $srv'" |
||||
|
pri=`ls /etc/rc.d/rc?.d/[SX]??$srv 2> /dev/null | \ |
||||
|
cut -c18-19 | head -n 1` |
||||
|
[ -z "$pri" ] && pri=99 |
||||
|
|
||||
|
for rl in 1 2 3 4 5 ; do |
||||
|
if [ -e /etc/rc.d/rc$rl.d/S??$srv ] |
||||
|
then cmd="$cmd '[*] " ; else cmd="$cmd '[ ] " ; fi |
||||
|
cmd="$cmd Run this script in runlevel $rl'" |
||||
|
cmd="$cmd 'chrlv $srv $rl $pri'" |
||||
|
done |
||||
|
|
||||
|
cmd="$cmd '$pri This scripts priority (01-99)'" |
||||
|
cmd="$cmd 'chpri $srv $pri' '' ''" |
||||
|
|
||||
|
cmd="$cmd 'Edit /etc/rc.d/init.d/$srv script'" |
||||
|
cmd="$cmd \"gui_edit 'SysV Init Script $srv'" |
||||
|
cmd="$cmd /etc/rc.d/init.d/$srv\"" |
||||
|
cmd="$cmd \"(Re-)Start the '$srv' system service\"" |
||||
|
cmd="$cmd '$STONE runlevel restart $srv'" |
||||
|
eval "$cmd" |
||||
|
do : ; done |
||||
|
} |
||||
|
|
||||
|
restart() { |
||||
|
gui_cmd "(Re-)Starting System Service '$1'" \ |
||||
|
"/sbin/rc $1 stop ; /sbin/rc $1 start" |
||||
|
} |
||||
|
|
||||
|
main() { |
||||
|
while |
||||
|
cmd="gui_menu runlevel 'Runlevel Editor - Select an" |
||||
|
cmd="$cmd item to change the priority or runlevels'" |
||||
|
|
||||
|
x=`mktemp` |
||||
|
for srv in $( ls /etc/rc.d/init.d/ ) |
||||
|
do |
||||
|
[ -f /etc/rc.d/init.d/$srv ] || continue |
||||
|
|
||||
|
pri=`ls /etc/rc.d/rc?.d/[SX]??$srv \ |
||||
|
2> /dev/null | cut -c18-19 | head -n 1` |
||||
|
[ -z "$pri" ] && pri=99 |
||||
|
|
||||
|
rlv='' |
||||
|
for x in 1 2 3 4 5 ; do |
||||
|
if [ -e /etc/rc.d/rc$x.d/S??$srv ] |
||||
|
then rlv="${rlv}$x" ; else rlv="${rlv}-" ; fi |
||||
|
done |
||||
|
|
||||
|
desc=`grep '# *Desc:' /etc/rc.d/init.d/$srv | \ |
||||
|
cut -f2- -d: | tr -d "'" | cut -c1-45` |
||||
|
desc="$( printf "%-10s %s" "$srv" "$desc" )" |
||||
|
|
||||
|
echo "$pri$srv '$pri $rlv $desc' 'edit_srv $srv'" |
||||
|
done | sort > $x |
||||
|
cmd="$cmd $(cut -f2- -d' ' < $x | tr '\n' ' ')" |
||||
|
rm -f $x ; eval "$cmd" |
||||
|
do : ; done |
||||
|
} |
||||
|
|
@ -0,0 +1,128 @@ |
|||||
|
# --- 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_setup.sh |
||||
|
# ROCK Linux is Copyright (C) 1998 - 2006 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 --- |
||||
|
# |
||||
|
# This module should only be executed once directly after the installation |
||||
|
|
||||
|
make_fstab() { |
||||
|
tmp1=`mktemp` ; tmp2=`mktemp` |
||||
|
|
||||
|
cat <<- EOT > $tmp2 |
||||
|
/dev/root / auto defaults 0 0 |
||||
|
proc /proc proc defaults 0 0 |
||||
|
devpts /dev/pts devpts defaults 0 0 |
||||
|
tmpfs /dev/shm tmpfs defaults 0 0 |
||||
|
sysfs /sys sysfs defaults 0 0 |
||||
|
/dev/bus/usb /proc/bus/usb bind bind 0 0 |
||||
|
#tmpfs /tmp tmpfs defaults 0 0 |
||||
|
EOT |
||||
|
|
||||
|
for x in /dev/cdroms/cdrom[0-9] ; do |
||||
|
if [ -e $x ] ; then |
||||
|
trg=/mnt/${x/*\//} ; trg=${trg/cdrom0/cdrom} |
||||
|
mkdir -p $trg |
||||
|
[ -L "$x" ] && x="`readlink -f $x`" |
||||
|
echo "$x $trg iso9660 ro,noauto 0 0" >> $tmp2 |
||||
|
fi |
||||
|
done |
||||
|
|
||||
|
for x in /dev/floppy/[0-9] ; do |
||||
|
if [ -e $x ] ; then |
||||
|
trg=/mnt/floppy${x/*\//} ; trg=${trg/floppy0/floppy} |
||||
|
mkdir -p $trg |
||||
|
[ -L "$x" ] && x="`readlink -f $x`" |
||||
|
echo "$x $trg auto sync,noauto 0 0" >> $tmp2 |
||||
|
fi |
||||
|
done |
||||
|
|
||||
|
sed -e "s/ nfs [^ ]\+/ nfs rw/" < /etc/mtab | \ |
||||
|
sed "s/ rw,/ /; s/ rw / defaults /" >> $tmp2 |
||||
|
grep '^/dev/' /proc/swaps | cut -f1 -d' ' | \ |
||||
|
sed 's,$, swap swap defaults 0 0,' >> $tmp2 |
||||
|
|
||||
|
cut -f2 -d' ' < $tmp2 | sort -u | while read dn ; do |
||||
|
grep " $dn " $tmp2 | tail -n 1; done > $tmp1 |
||||
|
|
||||
|
fsregex="$( echo -n $( ls /sbin/fsck.* | \ |
||||
|
cut -f2- -d. ) | sed 's, ,\\|,g' )" |
||||
|
gawk '{ printf("%-58s %d %d\n", |
||||
|
sprintf("%-45s ", sprintf("%-35s ", |
||||
|
sprintf("%-20s ", $1) $2) $3) $4, |
||||
|
$5, $6); }' < $tmp1 | \ |
||||
|
sed "/ \/[^ ].*\($fsregex\) / s, 0$, 1," > /etc/fstab |
||||
|
tr ' ' '\240' < /etc/fstab > $tmp1 |
||||
|
|
||||
|
gui_message $'Auto-created /etc/fstab file:\n\n'"$( cat $tmp1 )" |
||||
|
rm -f $tmp1 $tmp2 |
||||
|
} |
||||
|
|
||||
|
set_rootpw() { |
||||
|
if [ "$SETUPG" = dialog ] ; then |
||||
|
tmp1="`mktemp`" ; tmp2="`mktemp`" ; rc=0 |
||||
|
gui_dialog --nocancel --passwordbox "Setting a root password. ` |
||||
|
`Type password:" 8 70 > $tmp1 |
||||
|
gui_dialog --nocancel --passwordbox "Setting a root password. ` |
||||
|
`Retype password:" 8 70 > $tmp2 |
||||
|
if [ -s $tmp1 ] && cmp -s $tmp1 $tmp2 ; then |
||||
|
echo -n "root:" > $tmp1 ; echo >> $tmp2 |
||||
|
cat $tmp1 $tmp2 | chpasswd |
||||
|
else |
||||
|
gui_message "Password 1 and password 2 are ` |
||||
|
`not the same" ; rc=1 |
||||
|
fi |
||||
|
rm $tmp1 $tmp2 |
||||
|
return $rc |
||||
|
else |
||||
|
passwd root |
||||
|
return $? |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
main() { |
||||
|
ldconfig |
||||
|
export gui_nocancel=1 |
||||
|
|
||||
|
make_fstab |
||||
|
$STONE general set_keymap |
||||
|
while ! set_rootpw; do :; done |
||||
|
$STONE general set_tmarea |
||||
|
$STONE general set_dtime |
||||
|
$STONE general set_locale |
||||
|
$STONE general set_vcfont |
||||
|
|
||||
|
# source postinstall scripts added by misc packages |
||||
|
for x in ${SETUPD}/setup_*.sh ; do |
||||
|
[ -f $x ] && . $x |
||||
|
done |
||||
|
|
||||
|
# postinstall is called by cron.run / 00-updates - it wouldn't get |
||||
|
# called at all if cron isn't installed, so let's call it at lease |
||||
|
# once after installing / chrooting. |
||||
|
if [ -n "`which cron.run`" ] ; then |
||||
|
cron.run |
||||
|
else |
||||
|
postinstall -a |
||||
|
fi |
||||
|
|
||||
|
unset gui_nocancel |
||||
|
exec $STONE |
||||
|
} |
||||
|
|
@ -0,0 +1,181 @@ |
|||||
|
# --- 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/blindcoder/ezipupdate/mod_ezipupdate.sh |
||||
|
# ROCK Linux is Copyright (C) 1998 - 2005 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 --- |
||||
|
# |
||||
|
# [MAIN] 20 user User and Group management |
||||
|
|
||||
|
user_edit_user_change_shell() { # {{{ |
||||
|
IFS=: read username haspwd uid gid desc home shell < <( grep ^${1}: /etc/passwd ) |
||||
|
cmd="'Do not change' 'shell=${shell}'" |
||||
|
while read validshell ; do |
||||
|
cmd="${cmd} '${validshell}' 'shell=${validshell}'" |
||||
|
done < /etc/shells |
||||
|
eval "gui_menu user_edit_user_change_shell 'Change login shell for ${username}' ${cmd}" |
||||
|
} # }}} |
||||
|
user_edit_user() { # {{{ |
||||
|
IFS=: read username haspwd uid gid desc home shell < <( grep ^${1}: /etc/passwd ) |
||||
|
read oldline < <( grep ^${1}: /etc/passwd ) |
||||
|
groups="`egrep -e"[:,]$1[, $]?" /etc/group | cut -f1 -d: | tr '\n' ' '`" |
||||
|
run=0 |
||||
|
while [ ${run} -eq 0 ] ; do |
||||
|
cmd="'Login: ${username}' 'gui_input \"Enter new login for ${username}\" \"${username}\" username'" |
||||
|
cmd="${cmd} 'Has a password: $( [ -n "${haspwd}" ] && echo "yes" || echo "no" )' 'gui_yesno \"Must ${username} supply a password to login?\" && haspwd=x || unset haspwd'" |
||||
|
cmd="${cmd} 'User ID: ${uid}' 'gui_input \"Enter new user ID for ${username}\" \"${uid}\" uid'" |
||||
|
cmd="${cmd} 'Group ID: ${gid}' 'gui_input \"Enter new primary group ID for ${username}\" \"${gid}\" gid'" |
||||
|
cmd="${cmd} 'Long description: ${desc}' 'gui_input \"Enter new description for ${username}\" \"${desc}\" desc'" |
||||
|
cmd="${cmd} 'Home directory: ${home}' 'gui_input \"Enter new home directory for ${username}\" \"${home}\" home'" |
||||
|
cmd="${cmd} 'Shell: ${shell}' 'user_edit_user_change_shell ${username}'" |
||||
|
cmd="${cmd} 'Groups: ${groups}' 'user_edit_user_groups ${username}'" |
||||
|
cmd="${cmd} 'Set new password' 'passwd \"${username}\" ; read -p \"Press -<Return>- to continue\"'" |
||||
|
eval "gui_menu user_edit_user 'Manage account ${username}' ${cmd}" |
||||
|
run=${?} |
||||
|
done |
||||
|
sed -i /etc/passwd -e "s,^${oldline}$,${username}:${haspwd}:${uid}:${gid}:${desc}:${home}:${shell}," |
||||
|
} # }}} |
||||
|
user_add_user() { # {{{ |
||||
|
unset username haspwd uid gid desc home shell |
||||
|
while [ -z "${username}" ] ; do |
||||
|
gui_input "Enter new username" "" username || return |
||||
|
if grep -q ^${username}: /etc/passwd ; then |
||||
|
gui_message "Username ${username} already exists!" |
||||
|
unset username |
||||
|
fi |
||||
|
done |
||||
|
gui_yesno "Does ${username} need a password to log in?" && haspwd=x |
||||
|
uid=0 |
||||
|
while IFS=: read a a id a ; do |
||||
|
[ ${uid} -lt ${id} ] && uid=${id} |
||||
|
done < <( grep -v ^nobody: /etc/passwd ) |
||||
|
uid=$(( ${uid} + 1 )) |
||||
|
gui_input "Enter new User ID" "${uid}" uid || return |
||||
|
IFS=: read a a gid a < <( grep ^users: /etc/group ) |
||||
|
gui_input "Enter new Group ID" "${gid:-100}" gid || return |
||||
|
gui_input "Enter new User Description" "" desc || return |
||||
|
gui_input "Enter home directory" "/home/${username}" home || return |
||||
|
gui_input "Enter new shell" "/bin/bash" shell || return |
||||
|
tmp="`mktemp`" |
||||
|
useradd -u "${uid}" -g "${gid}" -p "${haspwd}" -d "${home}" -m -s "${shell}" \ |
||||
|
-c "${desc}" "${username}" >${tmp} 2>&1 || \ |
||||
|
gui_message "Error creating user: `cat ${tmp}`" |
||||
|
rm "${tmp}" |
||||
|
} # }}} |
||||
|
user_edit_user_groups() { # {{{ |
||||
|
run=0 |
||||
|
while [ ${run} -eq 0 ] ; do |
||||
|
cmd="" |
||||
|
while IFS=: read group groupid members ; do |
||||
|
members=" ${members/,/ } " |
||||
|
status="" |
||||
|
if [[ "${groupid}" == "${gid}" ]] ; then |
||||
|
status="1" |
||||
|
elif [[ "${members}" == *\ ${1}\ * ]] ; then |
||||
|
status="X" |
||||
|
members="${members// ${1} / }" |
||||
|
else |
||||
|
status=" " |
||||
|
members="${members} ${1} " |
||||
|
fi |
||||
|
members="$( echo "${members}" | sed -e 's,^ *,,g' -e 's, *$,,g' -e 's, *, ,g' )" |
||||
|
members="${members// /,}" |
||||
|
cmd="${cmd} '[${status}] ${group}' 'sed -i /etc/group -e \"s/^\(${group}.*:\).*$/\1${members}/\"'" |
||||
|
done < <( cut -f 1,3,4 -d: /etc/group ) |
||||
|
groups="`egrep -e"[:,]$1[, $]?" /etc/group | cut -f1 -d: | tr '\n' ' '`" |
||||
|
eval "gui_menu user_edit_user_groups 'Manage Group Memberships of User ${1}' ${cmd}" |
||||
|
run=${?} |
||||
|
done |
||||
|
} # }}} |
||||
|
user_edit_group_members() { # {{{ |
||||
|
IFS=: read groupname haspwd gid members < <( grep ^${1}: /etc/group ) |
||||
|
read oldline < <( grep ^${1}: /etc/group ) |
||||
|
run=0 |
||||
|
members=" ${members//,/ } " |
||||
|
while [ ${run} -eq 0 ] ; do |
||||
|
cmd="" |
||||
|
while read x ; do |
||||
|
if [[ "${members}" == *\ ${x}\ * ]] ; then |
||||
|
cmd="${cmd} '[X] ${x}' 'members=\${members// ${x} / }'" |
||||
|
else |
||||
|
cmd="${cmd} '[ ] ${x}' 'members=\"\${members} ${x} \"'" |
||||
|
fi |
||||
|
done < <( cut -f 1 -d: /etc/passwd ) |
||||
|
eval "gui_menu user_edit_group_members 'Manage Members of group ${groupname}' ${cmd}" |
||||
|
run=${?} |
||||
|
done |
||||
|
members="$( echo "${members}" | sed -e 's,^ *,,g' -e 's, *$,,g' -e 's, *, ,g' )" |
||||
|
members=${members// /,} |
||||
|
sed -i /etc/group -e "s/^${oldline}$/${groupname}:${haspwd}:${gid}:${members}/" |
||||
|
echo ${members} >&2 |
||||
|
} # }}} |
||||
|
user_edit_group() { # {{{ |
||||
|
IFS=:, read groupname haspwd gid members < <( grep ^${1}: /etc/group ) |
||||
|
read oldline < <( grep ^${1}: /etc/group ) |
||||
|
run=0 |
||||
|
while [ ${run} -eq 0 ] ; do |
||||
|
cmd="'Group name: ${groupname}' 'gui_input \"Enter new group name\" \"${groupname}\" groupname'" |
||||
|
cmd="${cmd} 'Group ID: ${gid}' 'gui_input \"Enter new group ID\" \"${gid}\" gid'" |
||||
|
memb="${members:0:25}" |
||||
|
[ -n "${members:25}" ] && memb="${memb}..." |
||||
|
cmd="${cmd} 'Members: ${memb}' 'exec 3>&2 ; members=\`user_edit_group_members ${groupname} 2>&1 1>&3\`'" |
||||
|
# fake says this line is unmaintainable. I say it's not. Anyway: |
||||
|
# I modify the variable members from within the function user_edit_group_members |
||||
|
# that's all :) |
||||
|
eval "gui_menu user_edit_group 'Manage group ${groupname}' ${cmd}" |
||||
|
run=${?} |
||||
|
done |
||||
|
sed -i /etc/group -e "s/^${oldline}$/${groupname}:${haspwd}:${gid}:${members// /,}/" |
||||
|
} # }}} |
||||
|
user_add_group() { # {{{ |
||||
|
unset groupname gid |
||||
|
while [ -z "${groupname}" ] ; do |
||||
|
gui_input "Enter new Group Name" "" groupname || return |
||||
|
if grep -q "^${groupname}:" /etc/group ; then |
||||
|
gui_message "Group ${groupname} already exists!" |
||||
|
unset groupname |
||||
|
fi |
||||
|
done |
||||
|
gid=0 |
||||
|
while IFS=: read a a id a ; do |
||||
|
[ ${gid} -lt ${id} ] && gid=${id} |
||||
|
done < <( grep -v ^nobody: /etc/passwd | grep -v ^nogroup: ) |
||||
|
gid=$(( ${gid} + 1 )) |
||||
|
gui_input "Enter new Group ID" "${gid}" gid || return |
||||
|
tmp="`mktemp`" |
||||
|
groupadd -g "${gid}" "${groupname}" > ${tmp} 2>&1 || \ |
||||
|
gui_message "Error creating group: `cat ${tmp}`" |
||||
|
rm "${tmp}" |
||||
|
} # }}} |
||||
|
main() { # {{{ |
||||
|
run=0 |
||||
|
while [ ${run} -eq 0 ] ; do |
||||
|
cmd="'User Management' ''" |
||||
|
while IFS=: read username haspwd uid gid desc home shell ; do |
||||
|
cmd="${cmd} '${desc:-No description} (${username})' 'user_edit_user ${username}'" |
||||
|
done < /etc/passwd |
||||
|
cmd="${cmd} 'Add new user' 'user_add_user' '' ''" |
||||
|
cmd="${cmd} 'Group Management' ''" |
||||
|
while IFS=: read groupname haspwd gid members ; do |
||||
|
cmd="${cmd} '${groupname}' 'user_edit_group ${groupname}'" |
||||
|
done < /etc/group |
||||
|
cmd="${cmd} 'Add new group' 'user_add_group'" |
||||
|
eval "gui_menu user 'User and Group management' ${cmd}" |
||||
|
run=${?} |
||||
|
done |
||||
|
} # }}} |