/usr/sbin/fai-nfsroot2image is in fai-server 4.3.1+deb8u1.
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 | #!/bin/bash
#*********************************************************************
#
# fai-nfsroot2image
#
# This script is part of FAI (Fully Automatic Installation)
# (c) 2011-2012 by Thomas Lange, lange@informatik.uni-koeln.de
# Universitaet zu Koeln
#
#*********************************************************************
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# A copy of the GNU General Public License is available as
# `/usr/share/common-licences/GPL' in the Debian GNU/Linux distribution
# or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html. You
# can also obtain it by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#*********************************************************************
# default list of dirs to be excluded
excludeopt="-wildcards -e usr/share/locale/* -e usr/share/doc/* -e var/lib/apt/* -e var/cache/apt/* -e usr/share/man/* -e var/lib/dpkg/info/* -e boot/*"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
usage() {
cat <<-EOF
fai-nfsroot2image [options] <nfsroot directory> image.squashfs
For more options read the man page fai-nfsroot2image(8)
EOF
exit 0
}
# - - - - - - - - - - - - - - - - - - - - - - - - - -
die() {
local e=$1 # first parameter is the exit code
shift
echo "ERROR: $@" 1>&2 # print error message
exit $e
}
# - - - - - - - - - - - - - - - - - - - - - - - - - -
# main program
remove=0
exclude=1
base=1
# Parse commandline options
while getopts "BEhR" opt ; do
case "$opt" in
h) usage ;;
E) exclude=0 ;;
B) base=0 ;;
R) remove=1 ;;
?) usage ;;
esac
done
shift $(($OPTIND - 1))
[ -z "$2" ] && usage
if [ -d $1/live/filesystem.dir ]; then
NFSROOT=$1/live/filesystem.dir
else
NFSROOT=$1
fi
isoname=$2
[ $base -eq 0 ] && excludeopt="$excludeopt -e var/tmp/base*" # also exclude base.tar.xz file
[ $exclude -eq 0 ] && excludeopt=
[ -d $NFSROOT ] || die 2 "$NFSROOT is not a directory."
[ $(id -u) != "0" ] && die 9 "Run this program as root."
[ $remove -eq 1 ] && rm -f $isoname
if [ -f $isoname ]; then
echo "$isoname already exists." 1>&2
die 2 "You can use -R to force the removal of this file."
fi
mksquashfs $NFSROOT $isoname $excludeopt
echo ""
echo -n "Squashfs image size and filename: "
du -sh $isoname
|