Make checks for writable directory posix compliant

Reported-by: Maxim Kammerer <mk@de.su>
X-Gentoo-Bug: 398931
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=398931
This commit is contained in:
William Hubbs 2012-01-20 16:48:24 -06:00
parent 2990e5a2e3
commit 6e2fbf6a0f
5 changed files with 8 additions and 8 deletions

View File

@ -10,11 +10,6 @@ depend()
keyword -prefix -timeout keyword -prefix -timeout
} }
dir_writable()
{
mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$
}
: ${wipe_tmp:=${WIPE_TMP:-yes}} : ${wipe_tmp:=${WIPE_TMP:-yes}}
: ${log_dmesg:=${LOG_DMESG:-yes}} : ${log_dmesg:=${LOG_DMESG:-yes}}

View File

@ -54,7 +54,7 @@ start()
eend $retval eend $retval
# Store the last font so we can use it ASAP on boot # 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 mkdir -p "$RC_LIBEXECDIR"/console
for font in /usr/share/consolefonts/"$consolefont".*; do for font in /usr/share/consolefonts/"$consolefont".*; do
: :

View File

@ -63,7 +63,7 @@ start()
fi fi
# Save the keymapping for use immediately at boot # Save the keymapping for use immediately at boot
if [ -w "$RC_LIBEXECDIR" ]; then if dir_writable "$RC_LIBEXECDIR"; then
mkdir -p "$RC_LIBEXECDIR"/console mkdir -p "$RC_LIBEXECDIR"/console
dumpkeys >"$RC_LIBEXECDIR"/console/keymap dumpkeys >"$RC_LIBEXECDIR"/console/keymap
fi fi

View File

@ -35,7 +35,7 @@ start()
done done
# Save the encoding for use immediately at boot # Save the encoding for use immediately at boot
if [ -w "$RC_LIBEXECDIR" ]; then if dir_writable "$RC_LIBEXECDIR"; then
mkdir -p "$RC_LIBEXECDIR"/console mkdir -p "$RC_LIBEXECDIR"/console
if yesno ${unicode:-${UNICODE}}; then if yesno ${unicode:-${UNICODE}}; then
echo "" > "$RC_LIBEXECDIR"/console/unicode echo "" > "$RC_LIBEXECDIR"/console/unicode

View File

@ -4,6 +4,11 @@
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name> # Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license. # Released under the 2-clause BSD license.
dir_writable()
{
mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$
}
sourcex() sourcex()
{ {
if [ "$1" = "-e" ]; then if [ "$1" = "-e" ]; then