/usr/share/tcos/scripts/tcos-top/20mountnfs is in initramfs-tools-tcos 0.89.93ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | #!/bin/sh
#
if [ "$1" = "prereqs" ]; then
exit 0
fi
. /scripts/functions
. /conf/tcos.conf
. /conf/tcos-run-functions
quiet=n
# if break=mountnfs STOP here
maybe_break mountnfs
# read /tmp/less_ram
if [ "$(cat /tmp/less_ram)" = "0" ]; then
# have more than TCOS_MIN_RAM
exit 0
fi
# if use NFS try to mount:
#
# SERVER_IP:/var/lib/tcos/fs-$(uname -r)
#
MNTOPT="ro,nolock,rsize=2048,wsize=2048,retrans=10"
NFS_RO=/mnt/nfs
NFS_RW=/root
mkdir -p /root
mkdir -p /mnt/nfs
# NFS or NBD ?
NFS_MODE=$(read_cmdline_var "nfsmode" "nfs")
if [ "${NFS_MODE}" = "nbd" ]; then
# mount root-$(uname -r).squashfs as /dev/nbd0
log_begin_msg "Mounting remote squashfs with NBD"
NBD_PORT=$(read_cmdline_var "nbdport" "2001")
# load 1 nbd devices
modprobe nbd nbds_max=1
# wait for device
while [ ! -e /dev/nbd0 ]; do
sleep 1
done
nbd-client tcos-server $NBD_PORT /dev/nbd0
sleep 1
mount /dev/nbd0 /mnt/nfs
log_end_msg $?
else
log_begin_msg "Trying to mount NFS"
nfsmount -o $MNTOPT $(read_server "nfs-server"):${TCOS_VAR}/fs-$(uname -r) ${NFS_RO} 2>/dev/null
# try again
if [ $? -ne 0 ]; then
log_begin_msg "Second retry to mount NFS"
nfsmount -o $MNTOPT $(read_server "nfs-server"):${TCOS_VAR}/fs-$(uname -r) ${NFS_RO} 2> /dev/null
fi
if [ $? -ne 0 ]; then
panic "Unable to mount NFS, check NFS service in server and ${TCOS_VAR}/fs-$(uname -r) dir"
fi
log_end_msg $?
fi # end of NFS_MODE
# remount /root in RW mode
log_begin_msg "Remounting root in RW mode"
mount_unionfs /mnt/ram /mnt/nfs /root
log_end_msg $?
maybe_break move_mnt
# Set browseable NFS and RAM dirs
mkdir -p /root/.dirs/nfs
mkdir -p /root/.dirs/ram
mount -o move /mnt/nfs /root/.dirs/nfs
mount -o move /mnt/ram /root/.dirs/ram
exit 0
|