This file is indexed.

/usr/share/tcos/scripts/tcos-top/20mountnfs is in initramfs-tools-tcos 0.89.86.

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
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/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"

  mkdir -p /mnt/ram
  mount -t tmpfs -o size=5m tmpfs /mnt/ram

  if [ $(grep -c unionfs /proc/modules) = 0 ] && [ $(grep -c aufs /proc/modules) != 0 ]; then
       mount -t aufs -o br:/mnt/ram:/mnt/nfs none /root >> /tmp/initramfs.debug 2>&1
  else

     # NFS mounts must have nfsro instead of ro (see man unionfs) with kernel < 2.6.22
     if [ "$(uname -r| awk -F"[.|-]" '{print $3}')" -lt 22 ] && [ "${NFS_MODE}" != "nbd" ] ; then
       mount -t unionfs -o dirs=/mnt/ram=rw:/mnt/nfs=nfsro unionfs /root
     else
       mount -t unionfs -o dirs=/mnt/ram=rw:/mnt/nfs=ro unionfs /root
     fi
  fi

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