diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in index ee3c20cc..c3824e02 100644 --- a/init.d/bootmisc.in +++ b/init.d/bootmisc.in @@ -10,11 +10,6 @@ depend() keyword -prefix -timeout } -dir_writable() -{ - mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$ -} - : ${wipe_tmp:=${WIPE_TMP:-yes}} : ${log_dmesg:=${LOG_DMESG:-yes}} diff --git a/init.d/consolefont.in b/init.d/consolefont.in index f83b0036..2f046d89 100644 --- a/init.d/consolefont.in +++ b/init.d/consolefont.in @@ -54,7 +54,7 @@ start() eend $retval # Store the last font so we can use it ASAP on boot - if [ $retval -eq 0 -a -w "$RC_LIBEXECDIR" ]; then + if [ $retval -eq 0 ] && dir_writable "$RC_LIBEXECDIR"; then mkdir -p "$RC_LIBEXECDIR"/console for font in /usr/share/consolefonts/"$consolefont".*; do : diff --git a/init.d/keymaps.in b/init.d/keymaps.in index 1b96f493..851af5eb 100644 --- a/init.d/keymaps.in +++ b/init.d/keymaps.in @@ -63,7 +63,7 @@ start() fi # Save the keymapping for use immediately at boot - if [ -w "$RC_LIBEXECDIR" ]; then + if dir_writable "$RC_LIBEXECDIR"; then mkdir -p "$RC_LIBEXECDIR"/console dumpkeys >"$RC_LIBEXECDIR"/console/keymap fi diff --git a/init.d/termencoding.in b/init.d/termencoding.in index edba715e..b4218980 100644 --- a/init.d/termencoding.in +++ b/init.d/termencoding.in @@ -35,7 +35,7 @@ start() done # Save the encoding for use immediately at boot - if [ -w "$RC_LIBEXECDIR" ]; then + if dir_writable "$RC_LIBEXECDIR"; then mkdir -p "$RC_LIBEXECDIR"/console if yesno ${unicode:-${UNICODE}}; then echo "" > "$RC_LIBEXECDIR"/console/unicode diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in index 8e7fa690..3b910017 100644 --- a/sh/runscript.sh.in +++ b/sh/runscript.sh.in @@ -4,6 +4,11 @@ # Copyright (c) 2007-2009 Roy Marples # Released under the 2-clause BSD license. +dir_writable() +{ + mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$ +} + sourcex() { if [ "$1" = "-e" ]; then