summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-04-08 23:25:48 +0000
committerRoy Marples <roy@marples.name>2008-04-08 23:25:48 +0000
commit6d8b36e09db079a4ea65acc3f90d26c0633412db (patch)
tree3278e54e8a41123e6be306281846b4b889ae2157
parent87597357116dffd4e1136c16aab431844877a247 (diff)
downloadopenrc-6d8b36e09db079a4ea65acc3f90d26c0633412db.tar.gz
openrc-6d8b36e09db079a4ea65acc3f90d26c0633412db.tar.bz2
openrc-6d8b36e09db079a4ea65acc3f90d26c0633412db.tar.xz
Fix netmout for nfs
-rw-r--r--init.d/bootmisc.in92
-rw-r--r--init.d/netmount.in8
2 files changed, 56 insertions, 44 deletions
diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in
index c6894e4..d2cae84 100644
--- a/init.d/bootmisc.in
+++ b/init.d/bootmisc.in
@@ -11,11 +11,19 @@ depend()
keyword noprefix
}
+dir_writeable()
+{
+ mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$
+}
+
cleanup_tmp_dir()
{
local dir=$1
- mkdir -p "${dir}"
+ if ! [ -d "${dir}" ]; then
+ mkdir -p "${dir}" || return $?
+ fi
+ dir_writeable "${dir}" || return 1
cd "${dir}"
if yesno ${wipe_tmp:-${WIPE_TMP:-yes}}; then
ebegin "Wiping ${dir} directory"
@@ -60,12 +68,7 @@ cleanup_tmp_dir()
start()
{
- if ! mkdir /.test.$$ 2>/dev/null; then
- ewarn "Skipping /var and /tmp initialization (ro root?)"
- return 0
- fi
- rmdir /.test.$$
-
+ local logw=false
# Ensure that our basic dirs exist
for x in /var/log /var/run /tmp; do
if ! [ -d "${x}" ]; then
@@ -76,28 +79,33 @@ start()
fi
done
- ebegin "Creating user login records"
- cp /dev/null /var/run/utmp
- [ -e /var/log/wtmp ] || cp /dev/null /var/log/wtmp
- chmod 0644 /var/run/utmp /var/log/wtmp
- eend 0
-
- ebegin "Cleaning /var/run"
- for x in $(find /var/run ! -type d ! -name utmp ! -name random-seed \
- ! -name ld-elf.so.hints ! -name ld.so.hints);
- do
- [ ! -f "${x}" ] && continue
- # Do not remove pidfiles of already running daemons
- case "${x}" in
- *.pid)
- start-stop-daemon --test --quiet --stop \
- --pidfile "${x}"
- [ $? -eq 0 ] && continue
+ if dir_writeable /var/run; then
+ ebegin "Creating user login records"
+ cp /dev/null /var/run/utmp
+ if dir_writeable /var/log; then
+ logw=true
+ [ -e /var/log/wtmp ] || cp /dev/null /var/log/wtmp
+ chmod 0644 /var/run/utmp /var/log/wtmp
+ fi
+ eend 0
+
+ ebegin "Cleaning /var/run"
+ for x in $(find /var/run ! -type d ! -name utmp \
+ ! -name random-seed \
+ ! -name ld-elf.so.hints ! -name ld.so.hints);
+ do
+ [ ! -f "${x}" ] && continue
+ # Do not remove pidfiles of already running daemons
+ case "${x}" in
+ *.pid)
+ start-stop-daemon --test --quiet \
+ --stop --pidfile "${x}" && continue
;;
- esac
- rm -f -- "${x}"
- done
- eend 0
+ esac
+ rm -f -- "${x}"
+ done
+ eend 0
+ fi
# Clean up /tmp directories
local tmp=
@@ -106,18 +114,22 @@ start()
done
chmod +t /tmp /var/tmp
- # Make sure our X11 stuff have the correct permissions
- # Omit the chown as bootmisc is run before network is up
- # and users may be using lame LDAP auth #139411
- rm -rf /tmp/.ICE-unix /tmp/.X11-unix
- mkdir -p /tmp/.ICE-unix /tmp/.X11-unix
- chmod 1777 /tmp/.ICE-unix /tmp/.X11-unix
- [ -x /sbin/restorecon ] && restorecon /tmp/.ICE-unix /tmp/.X11-unix
-
- # Create an 'after-boot' dmesg log
- if [ "${RC_SYS}" != "VSERVER" -a "${RC_SYS}" != "OPENVZ" ]; then
- dmesg > /var/log/dmesg
- chmod 640 /var/log/dmesg
+ if dir_writeable /tmp; then
+ # Make sure our X11 stuff have the correct permissions
+ # Omit the chown as bootmisc is run before network is up
+ # and users may be using lame LDAP auth #139411
+ rm -rf /tmp/.ICE-unix /tmp/.X11-unix
+ mkdir -p /tmp/.ICE-unix /tmp/.X11-unix
+ chmod 1777 /tmp/.ICE-unix /tmp/.X11-unix
+ [ -x /sbin/restorecon ] && restorecon /tmp/.ICE-unix /tmp/.X11-unix
+ fi
+
+ if ${logw} || dir_writeable /var/log; then
+ # Create an 'after-boot' dmesg log
+ if [ "${RC_SYS}" != "VSERVER" -a "${RC_SYS}" != "OPENVZ" ]; then
+ dmesg > /var/log/dmesg
+ chmod 640 /var/log/dmesg
+ fi
fi
rm -f /etc/nologin
diff --git a/init.d/netmount.in b/init.d/netmount.in
index d8ec159..a875e1d 100644
--- a/init.d/netmount.in
+++ b/init.d/netmount.in
@@ -23,12 +23,12 @@ depend()
{
# Only have portmap as a dependency if there is a nfs mount in fstab
# that is set to mount at boot
- local pmap=""
+ local pmap=
if need_portmap; then
- pmap="${pmap} rpc.statd"
+ pmap="rpc.statd"
[ -x @SYSCONFDIR@/init.d/rpcbind ] \
- && pmap="rpcbind" \
- || pmap="portmap"
+ && pmap="${pmap} rpcbind" \
+ || pmap="${pmap} portmap"
fi
config /etc/fstab