dba551a518
Fix below linters errors E010 The "do" should be on same line as for E010 The "do" should be on same line as while E011 Then keyword is not on same line as if or elif keyword E020 Function declaration not in format ^function name {$ Ignore: E041 Arithmetic expansion using $[ is deprecated for $(( E042 local declaration hides errors E043 Arithmetic compound has inconsistent return semantics E044 Use [[ for non-POSIX comparisions Story: 2003366 Task: 24423 Change-Id: I8b6b72e702d3e89d1813772d6bf16819e28e818c Signed-off-by: Martin Chen <haochuan.z.chen@intel.com>
101 lines
2.1 KiB
Bash
Executable File
101 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
### BEGIN INIT INFO
|
|
# Provides: mountnfs
|
|
# Required-Start: $local_fs $network $rpcbind
|
|
# Required-Stop:
|
|
# Default-Start: S
|
|
# Default-Stop:
|
|
### END INIT INFO
|
|
|
|
# . /etc/default/rcS
|
|
|
|
if [ "$1" = "stop" ]; then
|
|
# Avoid mounting if we're shutting down
|
|
exit 0
|
|
fi
|
|
|
|
#
|
|
# Run in a subshell because of I/O redirection.
|
|
#
|
|
test -f /etc/fstab && (
|
|
|
|
#
|
|
# Read through fstab line by line. If it is NFS, set the flag
|
|
# for mounting NFS filesystems. If any NFS partition is found and it
|
|
# not mounted with the nolock option, we start the rpcbind.
|
|
#
|
|
rpcbind=no
|
|
mount_nfs=no
|
|
mount_smb=no
|
|
mount_ncp=no
|
|
mount_cifs=no
|
|
while read device mountpt fstype options; do
|
|
case "$device" in
|
|
""|\#*)
|
|
continue
|
|
;;
|
|
esac
|
|
|
|
case "$options" in
|
|
*noauto*)
|
|
continue
|
|
;;
|
|
esac
|
|
|
|
if test "$fstype" = nfs
|
|
then
|
|
mount_nfs=yes
|
|
case "$options" in
|
|
*nolock*)
|
|
;;
|
|
*)
|
|
rpcbind=yes
|
|
;;
|
|
esac
|
|
fi
|
|
if test "$fstype" = smbfs
|
|
then
|
|
mount_smb=yes
|
|
fi
|
|
if test "$fstype" = ncpfs
|
|
then
|
|
mount_ncp=yes
|
|
fi
|
|
if test "$fstype" = cifs
|
|
then
|
|
mount_cifs=yes
|
|
fi
|
|
done
|
|
|
|
exec 0>&1
|
|
|
|
if test "$rpcbind" = yes; then
|
|
# WRL: Centos precheck: Dont start rpcbind in this init script.
|
|
# It is started by a systemd service file.
|
|
if test "/etc/centos-release" = no
|
|
then
|
|
if test -x /usr/sbin/rpcbind
|
|
then
|
|
service rpcbind status > /dev/null
|
|
if [ $? != 0 ]; then
|
|
echo -n "Starting rpcbind..."
|
|
start-stop-daemon --start --quiet --exec /usr/sbin/rpcbind
|
|
sleep 2
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
if test "$mount_nfs" = yes || test "$mount_smb" = yes || test "$mount_ncp" = yes || test "$mount_cifs" = yes; then
|
|
echo "Mounting remote filesystems..."
|
|
test "$mount_nfs" = yes && mount -a -t nfs
|
|
test "$mount_smb" = yes && mount -a -t smbfs
|
|
test "$mount_ncp" = yes && mount -a -t ncpfs
|
|
test "$mount_cifs" = yes && mount -a -t cifs
|
|
fi
|
|
|
|
) < /etc/fstab
|
|
|
|
: exit 0
|
|
|