From 64333346c2073e672e10151bc616d0649ac3b91f Mon Sep 17 00:00:00 2001 From: Jesse Hathaway Date: Tue, 30 Oct 2007 14:17:16 -0400 Subject: add new option to mount cow device on nfs volume At the moment this only works with the root volume on nfs as well. If we add a switch to configure the network early in the boot process then this option could be made available for other root mediums. This option works reliably on the latest kernel 2.6.23.1 On earlier kernels I experienced frequent oopses. --- functions/defaults.sh | 13 ++++--- helpers/lh_binary_grub | 6 ++++ helpers/lh_binary_net | 10 +++--- helpers/lh_binary_syslinux | 27 +++++++++++--- helpers/lh_binary_yaboot | 6 ++++ helpers/lh_chroot_hacks | 4 +++ helpers/lh_config | 88 +++++++++++++++++++++++++++++++++------------- manpages/lh_config.en.1 | 27 +++++++++++--- 8 files changed, 138 insertions(+), 43 deletions(-) diff --git a/functions/defaults.sh b/functions/defaults.sh index 30e4062..c389a6c 100755 --- a/functions/defaults.sh +++ b/functions/defaults.sh @@ -540,24 +540,27 @@ Set_defaults () LH_MEMTEST="${LH_MEMTEST:-memtest86+}" # Setting netboot filesystem - LH_NET_FILESYSTEM="${LH_NET_FILESYSTEM:-nfs}" + LH_NET_ROOT_FILESYSTEM="${LH_NET_ROOT_FILESYSTEM:-nfs}" # Setting netboot server path - if [ -z "${LH_NET_PATH}" ] + if [ -z "${LH_NET_ROOT_PATH}" ] then case "${LH_MODE}" in debian) - LH_NET_PATH="/srv/debian-live" + LH_NET_ROOT_PATH="/srv/debian-live" ;; debian-edu) - LH_NET_PATH="/srv/debian-edu-live" + LH_NET_ROOT_PATH="/srv/debian-edu-live" ;; esac fi # Setting netboot server address - LH_NET_SERVER="${LH_NET_SERVER:-192.168.1.1}" + LH_NET_ROOT_SERVER="${LH_NET_ROOT_SERVER:-192.168.1.1}" + + # Setting net cow filesystem + LH_NET_COW_FILESYSTEM="${LH_NET_COW_FILESYSTEM:-nfs}" # Setting syslinux configuration file # LH_SYSLINUX_CFG diff --git a/helpers/lh_binary_grub b/helpers/lh_binary_grub index 1c05962..5269d0a 100755 --- a/helpers/lh_binary_grub +++ b/helpers/lh_binary_grub @@ -178,6 +178,12 @@ then LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} union=${LH_UNION_FILESYSTEM}" fi +if [ -n "${LH_NET_COW_PATH}" ] +then + Echo_error "Net cow not yet supported on grub" + exit 1 +fi + if [ "${LH_EXPOSED_ROOT}" != "disabled" ] then LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} exposedroot" diff --git a/helpers/lh_binary_net b/helpers/lh_binary_net index ac7464e..8c61bce 100755 --- a/helpers/lh_binary_net +++ b/helpers/lh_binary_net @@ -59,21 +59,21 @@ then fi # Creating image file -if [ "$(basename ${LH_NET_PATH})" = "chroot" ] +if [ "$(basename ${LH_NET_ROOT_PATH})" = "chroot" ] then mv chroot chroot.tmp fi -mv binary "$(basename ${LH_NET_PATH})" +mv binary "$(basename ${LH_NET_ROOT_PATH})" cd .. -tar cfz binary-net.tar.gz "$(basename ${OLDPWD})/$(basename ${LH_NET_PATH})" "$(basename ${OLDPWD})/tftpboot" +tar cfz binary-net.tar.gz "$(basename ${OLDPWD})/$(basename ${LH_NET_ROOT_PATH})" "$(basename ${OLDPWD})/tftpboot" mv binary-net.tar.gz "${OLDPWD}" cd "${OLDPWD}" -mv "$(basename ${LH_NET_PATH})" binary +mv "$(basename ${LH_NET_ROOT_PATH})" binary -if [ "$(basename ${LH_NET_PATH})" = "chroot" ] +if [ "$(basename ${LH_NET_ROOT_PATH})" = "chroot" ] then mv chroot.tmp chroot fi diff --git a/helpers/lh_binary_syslinux b/helpers/lh_binary_syslinux index 9e85f46..34ea104 100755 --- a/helpers/lh_binary_syslinux +++ b/helpers/lh_binary_syslinux @@ -411,13 +411,13 @@ fi if [ "${LH_BINARY_IMAGES}" = "net" ] then - case "${LH_NET_FILESYSTEM}" in + case "${LH_NET_ROOT_FILESYSTEM}" in nfs) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} netboot=nfs nfsroot=${LH_NET_SERVER}:${LH_NET_PATH}" + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} netboot=nfs nfsroot=${LH_NET_ROOT_SERVER}:${LH_NET_ROOT_PATH}" ;; cifs) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} netboot=cifs nfsroot=//${LH_NET_SERVER}${LH_NET_PATH}" + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} netboot=cifs nfsroot=//${LH_NET_ROOT_SERVER}${LH_NET_ROOT_PATH}" ;; *) @@ -426,12 +426,29 @@ then ;; esac - if [ -n "${LH_NET_MOUNTOPTIONS}" ] + if [ -n "${LH_NET_ROOT_MOUNTOPTIONS}" ] then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} nfsopts=${LH_NET_MOUNTOPTIONS}" + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} nfsopts=${LH_NET_ROOT_MOUNTOPTIONS}" fi fi +if [ -n "${LH_NET_COW_PATH}" ] +then + case "${LH_NET_COW_FILESYSTEM}" in + nfs) + if [ -n "${LH_NET_COW_MOUNTOPTIONS}" ] + then + LH_NET_COW_MOUNTOPTIONS=",${LH_NET_COW_MOUNTOPTIONS}" + fi + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} nfscow=${LH_NET_COW_SERVER}:${LH_NET_COW_PATH}${LH_NET_COW_MOUNTOPTIONS}" + ;; + *) + Echo_error "Unsupported net filesystem" + exit 1 + ;; + esac +fi + LH_BOOTAPPEND_LIVE="$(echo ${LH_BOOTAPPEND_LIVE} | sed -e 's/ //')" # Parameters are listed at: linux/Documentation/kernel-parameters.txt diff --git a/helpers/lh_binary_yaboot b/helpers/lh_binary_yaboot index 93fc0bb..4f767b7 100755 --- a/helpers/lh_binary_yaboot +++ b/helpers/lh_binary_yaboot @@ -186,6 +186,12 @@ then LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} union=${LH_UNION_FILESYSTEM}" fi +if [ -n "${LH_NET_COW_PATH}" ] +then + Echo_error "Net cow not yet supported on yaboot" + exit 1 +fi + if [ "${LH_EXPOSED_ROOT}" != "disabled" ] then LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} exposedroot" diff --git a/helpers/lh_chroot_hacks b/helpers/lh_chroot_hacks index 6eaef4f..8c08d55 100755 --- a/helpers/lh_chroot_hacks +++ b/helpers/lh_chroot_hacks @@ -50,6 +50,10 @@ Create_lockfile .lock # Removing udev mac caching rule Chroot "rm -f /etc/udev/rules.d/z25_persistent-net.rules" +# Blanking out fstab, so the live-initramfs will know to populate it +Chroot "rm -f /etc/fstab" +Chroot "touch /etc/fstab" + case "${LH_BINARY_IMAGES}" in net) if [ ! -f chroot/usr/bin/smbmount ] diff --git a/helpers/lh_config b/helpers/lh_config index c3f018a..741b442 100755 --- a/helpers/lh_config +++ b/helpers/lh_config @@ -76,10 +76,14 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\ \t [--mirror-bootstrap-security URL]\n\ \t [--mirror-bootstrap URL]\n\ \t [--mode debian|debian-edu]\n\ -\t [--net-filesystem nfs|cfs]\n\ -\t [--net-mountoptions OPTIONS]\n\ -\t [--net-path PATH]\n\ -\t [--net-server IP|HOSTNAME]\n\ +\t [--net-root-filesystem nfs|cfs]\n\ +\t [--net-root-mountoptions OPTIONS]\n\ +\t [--net-root-path PATH]\n\ +\t [--net-root-server IP|HOSTNAME]\n\ +\t [--net-cow-filesystem nfs|cfs]\n\ +\t [--net-cow-mountoptions OPTIONS]\n\ +\t [--net-cow-path PATH]\n\ +\t [--net-cow-server IP|HOSTNAME]\n\ \t [-p|--packages-lists FILE]\n\ \t [--packages PACKAGE|\"PACKAGES\"]\n\ \t [--quiet]\n\ @@ -102,7 +106,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\ Local_arguments () { - ARGUMENTS="$(getopt --longoptions apt:,apt-ftp-proxy:,apt-http-proxy:,apt-pdiffs:,apt-pipeline:,apt-recommends:,apt-secure:,bootstrap:,cache:,cache-indices:,cache-packages:,cache-stages:,debconf-frontend:,debconf-nowarnings:,debconf-priority:,genisoimage:,initramfs:,losetup:,mode:,root-command:,tasksel:,includes:,templates:,architecture:,bootstrap-config:,bootstrap-flavour:,bootstrap-keyring:,distribution:,mirror-bootstrap:,mirror-bootstrap-security:,mirror-binary:,mirror-binary-security:,sections:,chroot-filesystem:,union-filesystem:,exposed-root:,hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:,packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,binary-images:,binary-indices:,bootappend-install:,bootappend-live:,bootloader:,chroot-build:,debian-installer:,debian-installer-daily:,encryption:,grub-splash:,hostname:,iso-application:,iso-preparer:,iso-publisher:,iso-volume:,memtest:,net-filesystem:,net-mountoptions:,net-path:,net-server:,syslinux-splash:,syslinux-timeout:,username:,source:,source-images:,breakpoints,conffile:,debug,force,help,quiet,usage,verbose,version --name=${PROGRAM} --options a:f:d:m:l:k:p:b:e:s:c:huv --shell sh -- "${@}")" + ARGUMENTS="$(getopt --longoptions apt:,apt-ftp-proxy:,apt-http-proxy:,apt-pdiffs:,apt-pipeline:,apt-recommends:,apt-secure:,bootstrap:,cache:,cache-indices:,cache-packages:,cache-stages:,debconf-frontend:,debconf-nowarnings:,debconf-priority:,genisoimage:,initramfs:,losetup:,mode:,root-command:,tasksel:,includes:,templates:,architecture:,bootstrap-config:,bootstrap-flavour:,bootstrap-keyring:,distribution:,mirror-bootstrap:,mirror-bootstrap-security:,mirror-binary:,mirror-binary-security:,sections:,chroot-filesystem:,union-filesystem:,exposed-root:,hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:,packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,binary-images:,binary-indices:,bootappend-install:,bootappend-live:,bootloader:,chroot-build:,debian-installer:,debian-installer-daily:,encryption:,grub-splash:,hostname:,iso-application:,iso-preparer:,iso-publisher:,iso-volume:,memtest:,net-root-filesystem:,net-root-mountoptions:,net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:,net-cow-server:,syslinux-splash:,syslinux-timeout:,username:,source:,source-images:,breakpoints,conffile:,debug,force,help,quiet,usage,verbose,version --name=${PROGRAM} --options a:f:d:m:l:k:p:b:e:s:c:huv --shell sh -- "${@}")" if [ "${?}" != "0" ] then @@ -464,23 +468,43 @@ Local_arguments () shift 2 ;; - --net-filesystem) - LH_NET_FILESYSTEM="${2}" + --net-root-filesystem) + LH_NET_ROOT_FILESYSTEM="${2}" shift 2 ;; - --net-mountoptions) - LH_NET_MOUNTOPTIONS="${2}" + --net-root-mountoptions) + LH_NET_ROOT_MOUNTOPTIONS="${2}" shift 2 ;; - --net-path) - LH_NET_PATH="${2}" + --net-root-path) + LH_NET_ROOT_PATH="${2}" shift 2 ;; - --net-server) - LH_NET_SERVER="${2}" + --net-root-server) + LH_NET_ROOT_SERVER="${2}" + shift 2 + ;; + + --net-cow-filesystem) + LH_NET_COW_FILESYSTEM="${2}" + shift 2 + ;; + + --net-cow-mountoptions) + LH_NET_COW_MOUNTOPTIONS="${2}" + shift 2 + ;; + + --net-cow-path) + LH_NET_COW_PATH="${2}" + shift 2 + ;; + + --net-cow-server) + LH_NET_COW_SERVER="${2}" shift 2 ;; @@ -911,21 +935,37 @@ LH_ISO_VOLUME="${LH_ISO_VOLUME}" # (Default: ${LH_MEMTEST}) LH_MEMTEST="${LH_MEMTEST}" -# \$LH_NET_FILESYSTEM: set netboot filesystem -# (Default: ${LH_NET_FILESYSTEM}) -LH_NET_FILESYSTEM="${LH_NET_FILESYSTEM}" +# \$LH_NET_ROOT_FILESYSTEM: set netboot filesystem +# (Default: ${LH_NET_ROOT_FILESYSTEM}) +LH_NET_ROOT_FILESYSTEM="${LH_NET_ROOT_FILESYSTEM}" + +# \$LH_NET_ROOT_MOUNTOPTIONS: set nfsopts +# (Default: empty) +LH_NET_ROOT_MOUNTOPTIONS="${LH_NET_ROOT_MOUNTOPTIONS}" + +# \$LH_NET_ROOT_PATH: set netboot server directory +# (Default: ${LH_NET_ROOT_PATH}) +LH_NET_ROOT_PATH="${LH_NET_ROOT_PATH}" + +# \$LH_NET_ROOT_SERVER: set netboot server address +# (Default: ${LH_NET_ROOT_SERVER}) +LH_NET_ROOT_SERVER="${LH_NET_ROOT_SERVER}" + +# \$LH_NET_COW_FILESYSTEM: set net client cow filesystem +# (Default: ${LH_NET_COW_FILESYSTEM}) +LH_NET_COW_FILESYSTEM="${LH_NET_COW_FILESYSTEM}" -# \$LH_NET_MOUNTOPTIONS: set nfsopts +# \$LH_NET_COW_MOUNTOPTIONS: set cow mount options # (Default: empty) -LH_NET_MOUNTOPTIONS="${LH_NET_MOUNTOPTIONS}" +LH_NET_COW_MOUNTOPTIONS="${LH_NET_COW_MOUNTOPTIONS}" -# \$LH_NET_PATH: set netboot server directory -# (Default: ${LH_NET_PATH}) -LH_NET_PATH="${LH_NET_PATH}" +# \$LH_NET_COW_PATH: set cow directory +# (Default: ${LH_NET_COW_PATH}) +LH_NET_COW_PATH="${LH_NET_COW_PATH}" -# \$LH_NET_SERVER: set netboot server address -# (Default: ${LH_NET_SERVER}) -LH_NET_SERVER="${LH_NET_SERVER}" +# \$LH_NET_COW_SERVER: set cow server +# (Default: ${LH_NET_COW_SERVER}) +LH_NET_COW_SERVER="${LH_NET_COW_SERVER}" # \$LH_SYSLINUX_SPLASH: set custom syslinux splash # (Default: empty) diff --git a/manpages/lh_config.en.1 b/manpages/lh_config.en.1 index ccde712..170a978 100644 --- a/manpages/lh_config.en.1 +++ b/manpages/lh_config.en.1 @@ -113,13 +113,32 @@ Here is the complete list of available options for lh_config. .IP "\fB\-\-mode\fR debian|debian\-edu" 4 -.IP "\fB\-\-net\-filesystem\fR nfs|cfs" 4 +.IP "\fB\-\-net\-root\-filesystem\fR nfs|cfs" 4 -.IP "\fB\-\-net\-mountoptions\fR \fIOPTION\fR|""\fIOPTIONS\fR""" 4 +.IP "\fB\-\-net\-root\-mountoptions\fR \fIOPTION\fR|""\fIOPTIONS\fR""" 4 -.IP "\fB\-\-net\-path\fR \fIPATH\fR" 4 +.IP "\fB\-\-net\-root\-path\fR \fIPATH\fR" 4 -.IP "\fB\-\-net\\-server\fR \fIIP\fR|\fIHOSTNAME\fR" 4 +.IP "\fB\-\-net\-root\\-server\fR \fIIP\fR|\fIHOSTNAME\fR" 4 + +.IP "\fB\-\-net\-cow\-filesystem\fR nfs" 4 + +.IP "\fB\-\-net\-cow\-mountoptions\fR \fIOPTION\fR|""\fIOPTIONS\fR""" 4 + +.IP "\fB\-\-net\-cow\-path\fR \fIPATH\fR" 4 +Specify path to client writable filesystem. Anywhere that +.BI "client_mac_address" +is specified in the path live-initramfs +will substitute the MAC address of the client delimited with hyphens. +.RS +.TP +EXAMPLE: +/export/hosts/client_mac_address +.br +/export/hosts/52-54-00-12-34-56 +.RE + +.IP "\fB\-\-net\-cow\\-server\fR \fIIP\fR|\fIHOSTNAME\fR" 4 .IP "\fB\-p|\-\-packages\-lists\fR \fIFILE\fR" 4 -- cgit v1.0