]> git.ipfire.org Git - people/jschlag/ipfire-2.x.git/blobdiff - src/initscripts/init.d/functions
initscripts: functions: Fix indentation
[people/jschlag/ipfire-2.x.git] / src / initscripts / init.d / functions
index 83d91695ed5bdadc21427bb637e6d55d9b69e141..58fdffeb4a997220381e7b400211b441aeb38ef4 100644 (file)
@@ -22,12 +22,12 @@ export PATH="/bin:/usr/bin:/sbin:/usr/sbin"
 RELOADSIG="HUP"
 
 # Number of seconds between STOPSIG and FALLBACK when stopping processes
-KILLDELAY="3"
+KILLDELAY="10"
 
 ## Screen Dimensions
 # Find current screen size
 if [ -z "${COLUMNS}" ]; then
-       COLUMNS=$(stty size)
+       COLUMNS=$(stty size 2>/dev/null)
        COLUMNS=${COLUMNS##* }
 fi
 
@@ -155,9 +155,9 @@ print_error_msg()
        boot_mesg -n " ipfire, please be so kind to inform us at"
        boot_mesg " info@ipfire.org.\n"
        boot_mesg_flush
-       boot_mesg -n "Press Enter to continue or wait 3 minutes..." ${INFO}
+       boot_mesg -n "Press Enter to continue or wait a minute..." ${INFO}
        boot_mesg "" ${NORMAL}
-       read -t 180 ENTER
+       read -t 60 ENTER
 }
 
 check_script_status()
@@ -438,7 +438,7 @@ loadproc()
 {
        local pidfile=""
        local forcestart=""
-       local nicelevel="10"
+       local nicelevel=""
 
 # This will ensure compatibility with previous LFS Bootscripts
        if [ -n "${PIDFILE}" ]; then
@@ -500,7 +500,13 @@ loadproc()
                esac
        fi
 
-       nice -n "${nicelevel}" "${@}"
+       local cmd="${@}"
+
+       if [ -n "${nicelevel}" ]; then
+               cmd="nice -n "${nicelevel}" ${cmd}"
+       fi
+
+       ${cmd}
        evaluate_retval # This is "Probably" not LSB compliant, but required to be compatible with older bootscripts
        return 0
 }
@@ -679,15 +685,54 @@ log_warning_msg() {
        return 0
 }
 
-animate()
-{
-       if [ $# = 0 ]
-               then
-               echo "Usage: animate {hook}"
-               exit 1
+run_subdir() {
+       DIR=$1
+       for i in $(ls -v ${DIR}* 2> /dev/null); do
+               check_script_status
+               OUT=$(echo $(basename ${i}) | awk -F- '{ print $2 }')
+               case "$OUT" in
+                       S) ${i} start   ;;
+                       K) ${i} stop ;;
+                       RS) ${i} restart ;;
+                       RL) ${i} reload ;;
+                       U) ${i} up ;;
+                       D) ${i} down ;;
+                       *) ${i} ;;
+               esac
+       done
+}
+
+mem_amount() {
+        local pagesize="$(getconf PAGESIZE)"
+        local pages="$(getconf _PHYS_PAGES)"
+
+        echo "$(( ${pagesize} * ${pages} / 1024 / 1024 ))"
+}
+
+mount_ramdisk() {
+       mount -t tmpfs none $1
+}
+
+umount_ramdisk() {
+       if mountpoint $1 &>/dev/null; then
+               umount $1
+       fi
+}
+
+backup_ramdisk() {
+       if [ ! -e $1.bak ]; then
+               mkdir -p $1.bak
        fi
 
-       splash "$*"
+       cp -pR $1/* $1.bak/
+       rm -rf $1/*
+}
+
+restore_ramdisk() {
+       if [ -e $1.bak ];then
+               cp -pR $1.bak/* $1/
+               rm -rf $1.bak/*
+       fi
 }
 
 # End $rc_base/init.d/functions