# functions This file contains functions to be used by most or all
# shell scripts in the /etc/init.d directory.
#
-# $Id: functions,v 1.54.2.3 2000/12/10 23:38:28 misiek Exp $
+# $Id: functions,v 1.54.2.4 2001/05/13 17:47:45 misiek Exp $
#
# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
# Hacked by: Greg Galloway and Marc Ewing
# printf equivalent
printf_()
{
- local text m
+ typeset text m
text="$1" ;
shift ;
if [ $# -gt 0 ]; then
# National language support function
nls()
{
- local msg_echo old_nls_domain text message
+ typeset msg_echo old_nls_domain text message
msg_echo='\n'
old_nls_domain="$NLS_DOMAIN"
# parse command line
# Some functions to handle PLD-style messages
show()
-{ local text
+{ typeset text
text=$(nls "$@")
echo -n "$text"
awk "BEGIN { for (j=length(\"$text\"); j<$INIT_COL; j++) printf \".\" }"
# used).
progress()
{
- local COLOR
+ typeset COLOR
if [ -n "$2" ]; then COLOR="$2"; else COLOR="2"; fi
deltext
echo -n "$(termput setaf 6)[$(termput setaf "$COLOR") $(nls --nls-domain rc-scripts "$1") $(termput setaf 6)]$(termput op)"
# Usage run_cmd Message command_to_run
run_cmd()
{
- local exit_code errors message force_err
+ typeset exit_code errors message force_err
typeset -i force_err=0
typeset -i exit_code=0
case "$1" in
# A function to start a program (now it's usefull on read-only filesystem too)
daemon()
{
- local nicelevel exit_code errors prog
+ typeset nicelevel exit_code errors prog
typeset -i nicelevel=0
typeset -i exit_code=0
[ -z "$DEFAULT_SERVICE_RUN_NICE_LEVEL" ] && DEFAULT_SERVICE_RUN_NICE_LEVEL=0
# A function to stop a program.
killproc()
{
- local notset killlevel base pid
+ typeset notset killlevel base pid
# Test syntax.
if [ $# = 0 ]; then
msg_usage " killproc {program} [signal]"
# A function to find the pid of a program.
pidofproc()
{
- local pid
+ typeset pid
# Test syntax.
if [ $# = 0 ] ; then
msg_usage " pidofproc {program}"
# Confirm whether we really want to run this service
confirm() {
- local answer
+ typeset answer
nls -n "Start service %s (Y)es/(N)o/(C)ontinue? [Y] " "$1"
read answer
case $answer in
_modprobe()
{
- local parsed single die args foo result
+ typeset parsed single die args foo result
parsed=no
while is_no "$parsed" ; do
case "$1" in
# description: This script is setting time zone information for your machine.
# Author: Pawel Wilk <siefca@pld.org.pl>
#
-# $Id: timezone,v 1.5.2.2 2001/03/05 14:35:06 misiek Exp $
+# $Id: timezone,v 1.5.2.3 2001/05/13 17:47:46 misiek Exp $
# NLS
NLS_DOMAIN="rc-scripts"
rm -f /etc/localtime
if [ -f "$ZONE_FILE" ]; then
if [ -n "$ZONE_INFO_AREA" ]; then
- MESSAGE="`nls "Setting time zone information (%s, %s)" "$ZONE_INFO_AREA" "$TIME_ZONE"`"
+ MESSAGE="`nls 'Setting time zone information (%s, %s)' "$ZONE_INFO_AREA" "$TIME_ZONE"`"
else
- MESSAGE="`nls "Setting time zone information (%s)" "$TIME_ZONE"`"
+ MESSAGE="`nls 'Setting time zone information (%s)' "$TIME_ZONE"`"
fi
run_cmd "$MESSAGE" ln -s $ZONE_FILE /etc/localtime
RETVAL=$?
# responsible for the very first setup of basic
# things, such as setting the hostname.
#
-# $Id: rc,v 1.25.2.1 2000/10/18 20:10:48 misiek Exp $
+# $Id: rc,v 1.25.2.2 2001/05/13 17:47:45 misiek Exp $
#
# Original Author:
# Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
af2=$(termput setaf 2)
af6=$(termput setaf 6)
af7=$(termput setaf 7)
-text="$(termput op)$(nls "%sResource Manager: %sEntering runlevel number" "$af2" "$af7")"
-text_size="$(nls "%sResource Manager: %sEntering runlevel number" "" "")"
-resp_size="$(nls "DONE")"
+text="$(termput op)$(nls '%sResource Manager: %sEntering runlevel number' "$af2" "$af7")"
+text_size="$(nls '%sResource Manager: %sEntering runlevel number' "" "")"
+resp_size="$(nls 'DONE')"
echo -n "$text"
awk "BEGIN { for (j=length(\"$text_size\"); j<$INIT_COL+${#resp_size}-${#runlevel}; j++) printf \".\" }"
echo "${af6}[${af2} $runlevel ${af6}]${af7}"
fi
# Say something ;)
-text="$(nls "%sResource Manager: %sRunlevel has been reached" "$af2" "$af7")"
-text_size="$(nls "%sResource Manager: %sRunlevel has been reached" "" "")"
+text="$(nls '%sResource Manager: %sRunlevel has been reached' "$af2" "$af7")"
+text_size="$(nls '%sResource Manager: %sRunlevel has been reached' "" "")"
echo -n "$text"
awk "BEGIN { for (j=length(\"$text_size\"); j<$INIT_COL+${#resp_size}-${#runlevel}; j++) printf \".\" }"
echo "${af6}[${af2} $runlevel ${af6}]${af7}"
# Changes: Grzegorz Stanislawski <stangrze@open.net.pl>
# Arkadiusz Mi¶kiewicz <misiek@pld.org.pl>
#
-# $Id: rc.shutdown,v 1.12.2.2 2001/05/10 19:23:24 misiek Exp $
+# $Id: rc.shutdown,v 1.12.2.3 2001/05/13 17:47:45 misiek Exp $
# Set the path.
PATH=/sbin:/bin:/usr/bin:/usr/sbin
if [ -f /proc/mdstat ] ; then
mddevs=$(awk '/^md.* active/ {print $1}' /proc/mdstat)
for mddev in $mddevs ; do
- MESSAGE="$(nls "Turning off RAID for %s" "$mddev")"
+ MESSAGE="$(nls 'Turning off RAID for %s' "$mddev")"
run_cmd "$MESSAGE" raidstop /dev/$mddev
done
unset mddev mddevs
#!/bin/sh
#
# /etc/rc.d/rc.sysinit - run once at boot time
-# $Id: rc.sysinit,v 1.69.2.7 2001/05/13 14:47:15 misiek Exp $
+# $Id: rc.sysinit,v 1.69.2.8 2001/05/13 17:47:45 misiek Exp $
#
# Taken in part from Miquel van Smoorenburg's bcheckrc.
# Changes: Arkadiusz Mi¶kiewicz <misiek@pld.org.pl>
# Check if timezone definition is available
if [ -e /etc/localtime ] ; then
- if run_cmd "$(nls "Setting clock")$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
- show "$(nls "Today's date:") $(LC_CTYPE=C date)"; ok
+ if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
+ show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
fi
else
TIME_SETUP_DELAYED=yes
run_cmd "Activating swap partitions" swapon -a
# Set the hostname.
-run_cmd "$(nls "Host:") ${HOSTNAME}" hostname ${HOSTNAME}
+run_cmd "$(nls 'Host:') ${HOSTNAME}" hostname ${HOSTNAME}
# Set the NIS domain name
if [ -n "$NISDOMAIN" ]; then
- run_cmd "$(nls "NIS Domain:") ${NISDOMAIN}" domainname $NISDOMAIN
+ run_cmd "$(nls 'NIS Domain:') ${NISDOMAIN}" domainname $NISDOMAIN
else
domainname ""
fi
# A return of 2 or higher means there were serious problems.
if [ $rc -gt 1 ]; then
# don't use '\n' in nls macro !
- echo "\n\n"
+ echo
+ echo
nls "*** An error occurred during the file system check."
nls "*** Dropping you to a shell; the system will reboot"
nls "*** when you leave the shell."
echo
- PS1="$(nls "(Repair filesystem)# ")"; export PS1
+ PS1="$(nls '(Repair filesystem)# ')"; export PS1
if is_yes "$RUN_SULOGIN_ON_ERR"; then
sulogin
else
# A non-zero return means there were problems.
if [ $rc -gt 0 ]; then
show "Starting up RAID devices."; fail
- echo "\n\n"
+ echo
+ echo
nls "*** An error occurred during the RAID startup"
nls "*** Dropping you to a shell; the system will reboot"
nls "*** when you leave the shell."
echo
- PS1="$(nls "(RAID Repair)# ")"; export PS1
+ PS1="$(nls '(RAID Repair)# ')"; export PS1
if is_yes "$RUN_SULOGIN_ON_ERR"; then
sulogin
else
# A return of 2 or higher means there were serious problems.
if [ $rc -gt 1 ]; then
- echo "\n\n"
+ echo
+ echo
nls "*** An error occurred during the file system check."
nls "*** Dropping you to a shell; the system will reboot"
nls "*** when you leave the shell."
echo
- PS1="$(nls "(Repair filesystem)# ")"; export PS1
+ PS1="$(nls '(Repair filesystem)# ')"; export PS1
if is_yes "$RUN_SULOGIN_ON_ERR"; then
sulogin
else
run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
run_cmd "Automatic reboot in progress." reboot
elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
+ if [ -x /sbin/convertquota ]; then
+ if [ -f /quota.user ]; then
+ /sbin/convertquota -u / && rm -f /quota.user
+ fi
+ if [ -f /quota.group ]; then
+ /sbin/convertquota -g / && rm -f /quota.group
+ fi
+ fi
run_cmd "Checking filesystem quotas" /sbin/quotacheck -v -u -g -R -a
fi
fi
# Set the clock if timezone definition wasn't available (eg. /usr not mounted)
if is_yes "$TIME_SETUP_DELAYED"; then
- if run_cmd "$(nls "Setting clock")$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
- show "$(nls "Today's date:") $(LC_CTYPE=C date)"; ok
+ if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
+ show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
fi
fi
fi
if [ -f /proc/sys/kernel/panic -a "$PANIC_REBOOT_TIME" -gt "0" ]; then
- show "Setting %s seconds for kernel reboot after panic." "$PANIC_REBOOT_TIME"; busy
+ show 'Setting %s seconds for kernel reboot after panic.' "$PANIC_REBOOT_TIME"; busy
if (sysctl -w kernel.panic=$PANIC_REBOOT_TIME 2> /dev/null); then ok; else fail; fi
fi
#!/bin/sh
#
-# $Id: ifup,v 1.42.2.7 2001/03/19 15:48:18 misiek Exp $
+# $Id: ifup,v 1.42.2.8 2001/05/13 17:47:46 misiek Exp $
#
PATH=/sbin:/usr/sbin:/bin:/usr/bin
fi
DHCP_ARGS="$DHCP_OPTIONS $DHCP_ARGS"
- if ! run_cmd "$(nls "Determining IP information for") $DEVICE ($(basename $DHCP_CLIENT))" $DHCP_CLIENT $DHCP_ARGS ; then
+ if ! run_cmd "$(nls 'Determining IP information for') $DEVICE ($(basename $DHCP_CLIENT))" $DHCP_CLIENT $DHCP_ARGS ; then
exit 1
fi
#!/bin/sh
#
-# $Id: ifup-ppp,v 1.13.2.3 2001/04/16 14:50:01 dobrek Exp $
+# $Id: ifup-ppp,v 1.13.2.4 2001/05/13 17:47:46 misiek Exp $
#
# ifup-ppp script for pppd-2.3.5 (with persist & demand options) ver 0.2
# Grzegorz Stanislawski <stangrze@open.net.pl>
nls "/usr/sbin/pppd does not exist or is not executable"
nls "ifup-ppp for %s exiting" "$DEVICE"
logger -p daemon.info -t ifup-ppp \
- "$(nls "/usr/sbin/pppd does not exist or is not executable for %s" "$DEVICE")"
+ "$(nls '/usr/sbin/pppd does not exist or is not executable for %s' "$DEVICE")"
exit 1
}