fai and make-fai-nfsroot: df -P option
michael log
mmlogin at gmail.com
Mon Oct 11 13:23:43 CEST 2010
Hello,
Here below are the corrections of "df" usage in fai and make-fai-nfsroot.
According to information from "info coreutils" if we used "df" without
portability option (-P) and the mount device name was more than 20
characters long then the mount device name is put on a line by itself.
And this breaks the logic of the part of the fai scripts which "check
if target directory is mounted with bad options".
debian:~# info coreutils 'df invocation'
`-P'
`--portability'
Use the POSIX output format. This is like the default format except
for the following:
1. The information about each file system is always printed on
exactly one line; a mount device is never put on a line by itself.
This means that if the mount evice name is more than 20 characters
long (e.g., for some network mounts), the columns are misaligned.
2. ...
These are proof steps:
debian:~# df -a
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/debian-root
3648584 846112 2617128 25% /
tmpfs 127372 0 127372 0% /lib/init/rw
proc 0 0 0 - /proc
sysfs 0 0 0 - /sys
udev 122444 88 122356 1% /dev
tmpfs 127372 0 127372 0% /dev/shm
devpts 0 0 0 - /dev/pts
/dev/sda1 233335 26914 193973 13% /boot
nfsd 0 0 0 - /proc/fs/nfsd
debian:~# df /srv/fai/nfsroot/live/filesystem.dir
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/debian03-root
3648584 846112 2617128 25% /
debian:~# df /srv/fai/nfsroot/live/filesystem.dir | tail -1
3648584 846112 2617128 25% /
debian:~# df /srv/fai/nfsroot/live/filesystem.dir | tail -1 | awk '{print $6}'
debian:~#
debian:~# df -P /srv/fai/nfsroot/live/filesystem.dir | tail -1 | awk
'{print $6}'
/
debian:~#
Index: bin/fai
===================================================================
--- bin/fai (revision 6121)
+++ bin/fai (working copy)
@@ -225,7 +225,7 @@
FAI_ROOT=$(cd $FAI_ROOT;pwd)
# check if target directory is mounted with bad options
- fs=$(df $FAI_ROOT | tail -1 | awk '{print $6}')
+ fs=$(df -P $FAI_ROOT | tail -1 | awk '{print $6}')
if mount | grep "on $fs " | awk '{print $6}' | egrep -q
"nosuid|nodev"; then
echo "Target directory is mounted using nosuid or nodev. Aborting"
exit 5
Index: bin/make-fai-nfsroot
===================================================================
--- bin/make-fai-nfsroot (revision 6121)
+++ bin/make-fai-nfsroot (working copy)
@@ -234,7 +234,7 @@
call_debootstrap() {
# check if NFSROOT directory is mounted with bad options
- fs=$(df $NFSROOT | tail -1 | awk '{print $6}')
+ fs=$(df -P $NFSROOT | tail -1 | awk '{print $6}')
if mount | grep "on $fs " | awk '{print $6}' | egrep -q
"nosuid|nodev"; then
die 1 "NFSROOT directory $NFSROOT is mounted using nosuid or
nodev. Aborting"
fi
regards,
Michael.
More information about the linux-fai-devel
mailing list