Fix netmout for nfs
This commit is contained in:
parent
8759735711
commit
6d8b36e09d
@ -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
|
||||||
|
|
||||||
|
if dir_writeable /var/run; then
|
||||||
ebegin "Creating user login records"
|
ebegin "Creating user login records"
|
||||||
cp /dev/null /var/run/utmp
|
cp /dev/null /var/run/utmp
|
||||||
|
if dir_writeable /var/log; then
|
||||||
|
logw=true
|
||||||
[ -e /var/log/wtmp ] || cp /dev/null /var/log/wtmp
|
[ -e /var/log/wtmp ] || cp /dev/null /var/log/wtmp
|
||||||
chmod 0644 /var/run/utmp /var/log/wtmp
|
chmod 0644 /var/run/utmp /var/log/wtmp
|
||||||
|
fi
|
||||||
eend 0
|
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 random-seed \
|
||||||
! -name ld-elf.so.hints ! -name ld.so.hints);
|
! -name ld-elf.so.hints ! -name ld.so.hints);
|
||||||
do
|
do
|
||||||
[ ! -f "${x}" ] && continue
|
[ ! -f "${x}" ] && continue
|
||||||
# Do not remove pidfiles of already running daemons
|
# Do not remove pidfiles of already running daemons
|
||||||
case "${x}" in
|
case "${x}" in
|
||||||
*.pid)
|
*.pid)
|
||||||
start-stop-daemon --test --quiet --stop \
|
start-stop-daemon --test --quiet \
|
||||||
--pidfile "${x}"
|
--stop --pidfile "${x}" && continue
|
||||||
[ $? -eq 0 ] && 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,6 +114,7 @@ start()
|
|||||||
done
|
done
|
||||||
chmod +t /tmp /var/tmp
|
chmod +t /tmp /var/tmp
|
||||||
|
|
||||||
|
if dir_writeable /tmp; then
|
||||||
# Make sure our X11 stuff have the correct permissions
|
# Make sure our X11 stuff have the correct permissions
|
||||||
# Omit the chown as bootmisc is run before network is up
|
# Omit the chown as bootmisc is run before network is up
|
||||||
# and users may be using lame LDAP auth #139411
|
# and users may be using lame LDAP auth #139411
|
||||||
@ -113,12 +122,15 @@ 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
|
||||||
|
|
||||||
|
if ${logw} || dir_writeable /var/log; then
|
||||||
# Create an 'after-boot' dmesg log
|
# Create an 'after-boot' dmesg log
|
||||||
if [ "${RC_SYS}" != "VSERVER" -a "${RC_SYS}" != "OPENVZ" ]; then
|
if [ "${RC_SYS}" != "VSERVER" -a "${RC_SYS}" != "OPENVZ" ]; then
|
||||||
dmesg > /var/log/dmesg
|
dmesg > /var/log/dmesg
|
||||||
chmod 640 /var/log/dmesg
|
chmod 640 /var/log/dmesg
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
rm -f /etc/nologin
|
rm -f /etc/nologin
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user