Create needed dirs in bootmisc if they do not exist

This commit is contained in:
Roy Marples 2007-07-30 11:31:29 +00:00
parent 380b7f917d
commit 02fcdeede4

View File

@ -26,11 +26,21 @@ start() {
fi fi
fi fi
if ! echo 2>/dev/null >/var/run/.test.$$ ; then if ! echo 2>/dev/null >/.test.$$ ; then
ewarn "Skipping /var and /tmp initialization (ro root?)" ewarn "Skipping /var and /tmp initialization (ro root?)"
return 0 return 0
fi fi
rm -f /var/run/.test.$$ rm -f /.test.$$
# Ensure that our basic dirs exist
for x in /var/lock /var/run /tmp ; do
if ! [ -d "${x}" ] ; then
if ! mkdir "${x}" ; then
eend 1 "failed to create needed directory ${x}"
return 1
fi
fi
done
if [ "${RC_UNAME}" = "Linux" ] ; then if [ "${RC_UNAME}" = "Linux" ] ; then
# Setup login records # Setup login records
@ -46,7 +56,7 @@ start() {
eend $? eend $?
# Take care of random stuff [ /var/lock | /var/run | pam ] # Take care of random stuff [ /var/lock | /var/run | pam ]
ebegin "Cleaning" /var/lock, /var/run ebegin "Cleaning /var/lock, /var/run"
rm -rf /var/run/console.lock /var/run/console/* rm -rf /var/run/console.lock /var/run/console/*
# Clean up any stale locks. # Clean up any stale locks.
@ -78,7 +88,6 @@ start() {
eend 0 eend 0
# Clean up /tmp directory # Clean up /tmp directory
if [ -d /tmp ] ; then
cd /tmp cd /tmp
if [ "${WIPE_TMP}" = "yes" ] ; then if [ "${WIPE_TMP}" = "yes" ] ; then
ebegin "Wiping /tmp directory" ebegin "Wiping /tmp directory"
@ -118,7 +127,6 @@ start() {
mkdir -p /tmp/.ICE-unix /tmp/.X11-unix mkdir -p /tmp/.ICE-unix /tmp/.X11-unix
chmod 1777 /tmp/.ICE-unix /tmp/.X11-unix chmod 1777 /tmp/.ICE-unix /tmp/.X11-unix
[ -x /sbin/restorecon ] && restorecon /tmp/.ICE-unix /tmp/.X11-unix [ -x /sbin/restorecon ] && restorecon /tmp/.ICE-unix /tmp/.X11-unix
fi
# Create an 'after-boot' dmesg log # Create an 'after-boot' dmesg log
if [ "${RC_SYS}" != "VPS" ] ; then if [ "${RC_SYS}" != "VPS" ] ; then