Fix netmout for nfs

This commit is contained in:
Roy Marples 2008-04-08 23:25:48 +00:00
parent 8759735711
commit 6d8b36e09d
2 changed files with 54 additions and 42 deletions

View File

@ -11,11 +11,19 @@ depend()
keyword noprefix keyword noprefix
} }
dir_writeable()
{
mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$
}
cleanup_tmp_dir() cleanup_tmp_dir()
{ {
local dir=$1 local dir=$1
mkdir -p "${dir}" if ! [ -d "${dir}" ]; then
mkdir -p "${dir}" || return $?
fi
dir_writeable "${dir}" || return 1
cd "${dir}" cd "${dir}"
if yesno ${wipe_tmp:-${WIPE_TMP:-yes}}; then if yesno ${wipe_tmp:-${WIPE_TMP:-yes}}; then
ebegin "Wiping ${dir} directory" ebegin "Wiping ${dir} directory"
@ -60,12 +68,7 @@ cleanup_tmp_dir()
start() start()
{ {
if ! mkdir /.test.$$ 2>/dev/null; then local logw=false
ewarn "Skipping /var and /tmp initialization (ro root?)"
return 0
fi
rmdir /.test.$$
# Ensure that our basic dirs exist # Ensure that our basic dirs exist
for x in /var/log /var/run /tmp; do for x in /var/log /var/run /tmp; do
if ! [ -d "${x}" ]; then if ! [ -d "${x}" ]; then
@ -76,28 +79,33 @@ start()
fi fi
done done
ebegin "Creating user login records" if dir_writeable /var/run; then
cp /dev/null /var/run/utmp ebegin "Creating user login records"
[ -e /var/log/wtmp ] || cp /dev/null /var/log/wtmp cp /dev/null /var/run/utmp
chmod 0644 /var/run/utmp /var/log/wtmp if dir_writeable /var/log; then
eend 0 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" ebegin "Cleaning /var/run"
for x in $(find /var/run ! -type d ! -name utmp ! -name random-seed \ for x in $(find /var/run ! -type d ! -name utmp \
! -name ld-elf.so.hints ! -name ld.so.hints); ! -name random-seed \
do ! -name ld-elf.so.hints ! -name ld.so.hints);
[ ! -f "${x}" ] && continue do
# Do not remove pidfiles of already running daemons [ ! -f "${x}" ] && continue
case "${x}" in # Do not remove pidfiles of already running daemons
*.pid) case "${x}" in
start-stop-daemon --test --quiet --stop \ *.pid)
--pidfile "${x}" start-stop-daemon --test --quiet \
[ $? -eq 0 ] && continue --stop --pidfile "${x}" && continue
;; ;;
esac esac
rm -f -- "${x}" rm -f -- "${x}"
done done
eend 0 eend 0
fi
# Clean up /tmp directories # Clean up /tmp directories
local tmp= local tmp=
@ -106,18 +114,22 @@ start()
done done
chmod +t /tmp /var/tmp chmod +t /tmp /var/tmp
# Make sure our X11 stuff have the correct permissions if dir_writeable /tmp; then
# Omit the chown as bootmisc is run before network is up # Make sure our X11 stuff have the correct permissions
# and users may be using lame LDAP auth #139411 # Omit the chown as bootmisc is run before network is up
rm -rf /tmp/.ICE-unix /tmp/.X11-unix # and users may be using lame LDAP auth #139411
mkdir -p /tmp/.ICE-unix /tmp/.X11-unix rm -rf /tmp/.ICE-unix /tmp/.X11-unix
chmod 1777 /tmp/.ICE-unix /tmp/.X11-unix mkdir -p /tmp/.ICE-unix /tmp/.X11-unix
[ -x /sbin/restorecon ] && restorecon /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
# Create an 'after-boot' dmesg log if ${logw} || dir_writeable /var/log; then
if [ "${RC_SYS}" != "VSERVER" -a "${RC_SYS}" != "OPENVZ" ]; then # Create an 'after-boot' dmesg log
dmesg > /var/log/dmesg if [ "${RC_SYS}" != "VSERVER" -a "${RC_SYS}" != "OPENVZ" ]; then
chmod 640 /var/log/dmesg dmesg > /var/log/dmesg
chmod 640 /var/log/dmesg
fi
fi fi
rm -f /etc/nologin rm -f /etc/nologin

View File

@ -23,12 +23,12 @@ depend()
{ {
# Only have portmap as a dependency if there is a nfs mount in fstab # Only have portmap as a dependency if there is a nfs mount in fstab
# that is set to mount at boot # that is set to mount at boot
local pmap="" local pmap=
if need_portmap; then if need_portmap; then
pmap="${pmap} rpc.statd" pmap="rpc.statd"
[ -x @SYSCONFDIR@/init.d/rpcbind ] \ [ -x @SYSCONFDIR@/init.d/rpcbind ] \
&& pmap="rpcbind" \ && pmap="${pmap} rpcbind" \
|| pmap="portmap" || pmap="${pmap} portmap"
fi fi
config /etc/fstab config /etc/fstab