[Fai-commit] r6776 - in trunk: . bin debian man

Thomas Lange lange at alioth.debian.org
Wed Oct 26 15:39:02 UTC 2011


Author: lange
Date: 2011-10-26 15:39:02 +0000 (Wed, 26 Oct 2011)
New Revision: 6776

Added:
   trunk/bin/fai-nfsroot2image
   trunk/man/fai-nfsroot2image.8
Modified:
   trunk/Makefile
   trunk/debian/fai-server.install
   trunk/debian/fai-server.manpages
Log:
add fai-nfsroot2image sript and man page

Creates a squashfs from the nfsroot. So, FAI can be used without NFS.


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2011-10-26 14:31:25 UTC (rev 6775)
+++ trunk/Makefile	2011-10-26 15:39:02 UTC (rev 6776)
@@ -5,7 +5,7 @@
 export DOCDIR = $(shell pwd)/debian/fai-doc/usr/share/doc/fai-doc
 LIBDIR = $(DESTDIR)/usr/lib/fai
 SHAREDIR = $(DESTDIR)/usr/share/fai
-USRSBIN_SCRIPTS = make-fai-nfsroot fai-setup fcopy ftar install_packages fai-chboot faimond fai-cd fai faireboot fai-statoverride setup-storage dhcp-edit
+USRSBIN_SCRIPTS = make-fai-nfsroot fai-setup fcopy ftar install_packages fai-chboot faimond fai-cd fai faireboot fai-statoverride setup-storage dhcp-edit fai-nfsroot2image
 
 USRBIN_SCRIPTS = fai-class fai-do-scripts fai-mirror fai-debconf device2grub policy-rc.d.fai ainsl faimond-gui
 

Added: trunk/bin/fai-nfsroot2image
===================================================================
--- trunk/bin/fai-nfsroot2image	                        (rev 0)
+++ trunk/bin/fai-nfsroot2image	2011-10-26 15:39:02 UTC (rev 6776)
@@ -0,0 +1,89 @@
+#!/bin/bash
+
+#*********************************************************************
+#
+# fai-nfsroot2image
+#
+# This script is part of FAI (Fully Automatic Installation)
+# (c) 2011 by Thomas Lange, lange at 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
+
+NFSROOT=$1/live/filesystem.dir
+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


Property changes on: trunk/bin/fai-nfsroot2image
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/debian/fai-server.install
===================================================================
--- trunk/debian/fai-server.install	2011-10-26 14:31:25 UTC (rev 6775)
+++ trunk/debian/fai-server.install	2011-10-26 15:39:02 UTC (rev 6776)
@@ -4,6 +4,7 @@
 usr/sbin/fai-setup
 usr/sbin/faimond
 usr/sbin/make-fai-nfsroot
+usr/sbin/fai-nfsroot2image
 usr/sbin/dhcp-edit
 usr/bin/fai-mirror
 usr/share/fai/pixmaps/*

Modified: trunk/debian/fai-server.manpages
===================================================================
--- trunk/debian/fai-server.manpages	2011-10-26 14:31:25 UTC (rev 6775)
+++ trunk/debian/fai-server.manpages	2011-10-26 15:39:02 UTC (rev 6776)
@@ -5,4 +5,5 @@
 debian/tmp/man/faimond.8
 debian/tmp/man/faimond-gui.1
 debian/tmp/man/make-fai-nfsroot.8
+debian/tmp/man/fai-nfsroot2image.8
 debian/tmp/man/dhcp-edit.8

Added: trunk/man/fai-nfsroot2image.8
===================================================================
--- trunk/man/fai-nfsroot2image.8	                        (rev 0)
+++ trunk/man/fai-nfsroot2image.8	2011-10-26 15:39:02 UTC (rev 6776)
@@ -0,0 +1,64 @@
+.\"                                      Hey, EMACS: -*- nroff -*-
+.TH ftar 8 "24 october 2011"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+fai-nfsroot2image \- make a compressed image from the nfsroot
+.SH SYNOPSIS
+.B fai-nfsroot2image
+.RI [ options ] " NFSROOT OUTPUT"
+.SH DESCRIPTION
+Create an image of the nfsroot. Currently, this image can only contain
+a squashfs file system. You can use this image for booting a FAI
+client without mounting the FAI nfsroot by NFS. Instead, the client
+can fetch this image via http and use it as its root file system.
+
+.SH OPTIONS
+.TP
+.B -B
+Exclude the base.tar.xz file from the image. Instead You can put this
+file into the basefiles subdirectory in your config space. 
+.TP
+.B -E
+Do not exclude any files from the nfsroot.
+.TP
+.B -R
+Remove the output file if it aready exists.
+.TP
+.B \-h
+Show help.
+
+.SH EXAMPLES
+.br
+Convert your nfsroot into a squashfs image:
+
+   # fai-nfsroot2image /srv/fai/nfsroot nfsroot.squashfs
+
+.SH NOTES
+.br
+You can put the nfsroot.squashfs file on a web server. Then add 
+the following kernel parameter to the pxelinux.cfg file of your FAI
+install client.
+
+  fetch=http://1.2.3.4/path/to/nfsroot.squashfs
+
+That way, you do not need the parameter nfsroot=/srv/fai/nfsroot any more.
+For more information on the fetch feature see live-boot(7).
+
+.br
+
+This program is part of FAI (Fully Automatic Installation).  See the FAI manual
+for more information on how to use ftar.  The FAI homepage is http://fai-project.org.
+
+.SH AUTHOR
+Thomas Lange <lange at informatik.uni-koeln.de>




More information about the Fai-commit mailing list