X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=grml-debootstrap;h=e7384f0fc70de5f313f8e81c3bb8b9d1f5b8a50a;hp=493ed7a74ac1b401f9cfd324a2d243fb9892f38b;hb=c653f571d6ed4d10dacc40bb9a09b63aed527db7;hpb=2976d922706a8756b66431d79f0262cc30c52ab4 diff --git a/grml-debootstrap b/grml-debootstrap index 493ed7a..e7384f0 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -93,9 +93,12 @@ Configuration options: instead of using /etc/debootstrap/packages. --nopackages Skip installation of packages defined in /etc/debootstrap/packages + --nokernel Skip installation of default kernel images. --nointerfaces Do not copy /etc/network/interfaces from host system to target system. (This option is automatically enabled when using --vmfile.) + --defaultinterfaces Install a default /etc/network/interfaces file (enabling + DHCP for eth0) instead of taking over config from host system. --debconf Pre-seed packages using specified pre-seed db file. --grmlrepos Enable Grml's Debian repository (deb.grml.org). --backportrepos Enable Debian's backports repository (backports.debian.org). @@ -331,7 +334,9 @@ fi [ "$_opt_hostname" ] && HOSTNAME=$_opt_hostname [ "$_opt_password" ] && ROOTPASSWORD=$_opt_password [ "$_opt_nopassword" ] && NOPASSWORD='yes' +[ "$_opt_defaultinterfaces" ] && DEFAULTINTERFACES="true" [ "$_opt_nointerfaces" ] && NOINTERFACES="true" +[ "$_opt_nokernel" ] && NOKERNEL="true" [ "$_opt_bootappend" ] && BOOT_APPEND=$_opt_bootappend [ "$_opt_grub" ] && GRUB=$_opt_grub [ "$_opt_arch" ] && ARCH=$_opt_arch @@ -1151,7 +1156,7 @@ preparechroot() { [ -n "$MIRROR" ] && echo "MIRROR=\"$MIRROR\"" >> $CHROOT_VARIABLES [ -n "$MKFS" ] && echo "MKFS=\"$MKFS\"" >> $CHROOT_VARIABLES [ -n "$NOPASSWORD" ] && echo "NOPASSWORD=\"true\"" >> $CHROOT_VARIABLES - [ -n "$NOINTERFACES" ] && echo "NOINTERFACES=\"true\"" >> $CHROOT_VARIABLES + [ -n "$NOKERNEL" ] && echo "NOKERNEL=\"true\"" >> $CHROOT_VARIABLES [ -n "$PACKAGES" ] && echo "PACKAGES=\"$PACKAGES\"" >> $CHROOT_VARIABLES [ -n "$PRE_SCRIPTS" ] && echo "PRE_SCRIPTS=\"$PRE_SCRIPTS\"" >> $CHROOT_VARIABLES [ -n "$RECONFIGURE" ] && echo "RECONFIGURE=\"$RECONFIGURE\"" >> $CHROOT_VARIABLES @@ -1228,17 +1233,38 @@ preparechroot() { [ -d $CONFFILES/usr ] && cp $VERBOSE -a -L $CONFFILES/usr/* $MNTPOINT/usr/ [ -d $CONFFILES/var ] && cp $VERBOSE -a -L $CONFFILES/var/* $MNTPOINT/var/ - # copy local network setup to chroot + # network setup + DEFAULT_INTERFACES="# /etc/network/interfaces - generated by grml-debootstrap + +# Include files from /etc/network/interfaces.d when using +# ifupdown v0.7.44 or newer: +#source-directory /etc/network/interfaces.d + +auto lo +iface lo inet loopback + +allow-hotplug eth0 +iface eth0 inet dhcp +" + if [ -n "$NOINTERFACES" ] ; then einfo "Not installing /etc/network/interfaces as requested via --nointerfaces option" ; eend 0 + elif [ -n "$DEFAULT_INTERFACES" ] ; then + einfo "Installing default /etc/network/interfaces as requested via --defaultinterfaces options." + echo "$DEFAULT_INTERFACES" > "${MNTPOINT}/etc/network/interfaces" + eend $? elif [ -n "$VIRTUAL" ] ; then - einfo "Installing into Virtual Machine, skipping installation of /etc/network/interfaces" ; eend 0 + einfo "Setting up Virtual Machine, installing default /etc/network/interfaces" + echo "$DEFAULT_INTERFACES" > "${MNTPOINT}/etc/network/interfaces" + eend $? elif [ -r /etc/network/interfaces ] ; then einfo "Copying /etc/network/interfaces from host to target system" - cp $VERBOSE /etc/network/interfaces $MNTPOINT/etc/network/interfaces + cp $VERBOSE /etc/network/interfaces "${MNTPOINT}/etc/network/interfaces" eend $? else - ewarn "Couldn't read /etc/network/interfaces, not copying to target system" ; eend 0 + ewarn "Couldn't read /etc/network/interfaces, installing default /etc/network/interfaces" + echo "$DEFAULT_INTERFACES" > "${MNTPOINT}/etc/network/interfaces" + eend $? fi # install config file providing some example entries