/usr/share/tcos/scripts/tcos-premount/15uselocal 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 | #!/bin/sh
#
if [ "$1" = "prereqs" ]; then
exit 0
fi
quiet=n
. /scripts/functions
# if break=uselocal STOP here
maybe_break uselocal
. /conf/tcos.conf
. /conf/tcos-run-functions
mkdir -p /mnt/tmp >/dev/null 2>&1
# DOCUMENTME uselocal | enable use of local disks
uselocal=$(read_cmdline_var "uselocal" "0")
if [ ${uselocal} = 0 ]; then
_log "USELOCAL uselocal not enabled from cmdline"
exit 0
fi
# try to mount any part in /mnt/tmp
#########################################
ext3_parts_num=$(grep ^/dev /etc/fstab|grep -c ext3)
ext3_parts_devs=$(grep ^/dev /etc/fstab|grep ext3 | awk '{print $1}')
vfat_parts_num=$(grep ^/dev /etc/fstab|grep -c vfat)
vfat_parts_devs=$(grep ^/dev /etc/fstab|grep vfat | awk '{print $1}')
need_free_space=131072
#########################################
if [ ${ext3_parts_num} != 0 ]; then
log_begin_msg "Try to use some ext3 parts"
for ext3 in ${ext3_parts_devs}; do
mount -t ext3 -o rw ${ext3} /mnt/tmp >> /tmp/initramfs.debug 2>&1
sync
sleep 1
if [ $(grep -c ${ext3} /proc/mounts) != 1 ]; then
_log "USELOCAL ${ext3} not mounted, next..."
# not mounted
else
_log "USELOCAL ${ext3} mounted, check free space"
free_space=$(df ${ext3}| grep ^/dev| awk '{print $4}')
# check if free space > 64 Mb
if [ ${free_space} -ge ${need_free_space} ] ; then
_log "USELOCAL have more than ${need_free_space} in ${ext3}"
log_end_msg 0
exit 0
else
_log "USELOCAL no free space in ${ext3}"
umount ${ext3}
fi
fi
done
# if here no ext3 part
log_end_msg 1
fi
if [ ${vfat_parts_num} != 0 ]; then
log_begin_msg "Try to use some vfat parts"
for vfat in ${vfat_parts_devs}; do
mount -t vfat -o rw ${vfat} /mnt/tmp >> /tmp/initramfs.debug 2>&1
sync
sleep 1
if [ $(grep -c ${vfat} /proc/mounts) != 1 ]; then
_log "USELOCAL ${vfat} not mounted, next..."
# not mounted
else
_log "USELOCAL ${vfat} mounted, check free space"
free_space=$(df ${vfat}| grep ^/dev| awk '{print $4}')
# check if free space > 64 Mb
if [ ${free_space} -ge ${need_free_space} ] ; then
_log "USELOCAL have more than ${need_free_space} in ${vfat}"
log_end_msg 0
exit 0
else
_log "USELOCAL no free space in ${vfat}"
umount ${vfat}
fi
fi
done
# if here no vfat part
log_end_msg 1
fi
log_begin_msg "NO parts avalaible (ext3 or fat)"
log_end_msg 0
exit 0
|