X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=src%2Finitscripts%2Finit.d%2Ffunctions;h=58fdffeb4a997220381e7b400211b441aeb38ef4;hb=5258a65deaba155637d44dba97958b90ed942197;hp=00cd6fa2a1a6d239cb751e36facaea7ad550a13c;hpb=8e7778a8fca173fede71bde64c06eb48690d8a1f;p=people%2Fjschlag%2Fipfire-2.x.git diff --git a/src/initscripts/init.d/functions b/src/initscripts/init.d/functions index 00cd6fa2a1..58fdffeb4a 100644 --- a/src/initscripts/init.d/functions +++ b/src/initscripts/init.d/functions @@ -27,7 +27,7 @@ KILLDELAY="10" ## Screen Dimensions # Find current screen size if [ -z "${COLUMNS}" ]; then - COLUMNS=$(stty size) + COLUMNS=$(stty size 2>/dev/null) COLUMNS=${COLUMNS##* } fi @@ -702,4 +702,37 @@ run_subdir() { 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 + + 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