diff --git a/debian/NEWS b/debian/NEWS index 244817a1..8c4f27b9 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -1,3 +1,16 @@ +grml-debootstrap (0.82+nmu1) UNRELEASED; urgency=medium + + Starting with this release grml-debootstrap enables systemd-networkd by + default on Debian/stretch systems. + + The old default behaviour where the host /etc/network/interfaces was used to + deploy the target network configuration was dropped in favor of using the + --defaultinterfaces option where all ethernet devices are configured to use + DHCP via systemd-networkd. For legacy reasons we also provide a + /etc/network/interfaces where `eth0` is configured to use DHCP. + + -- Darshaka Pathirana Wed, 25 Jul 2018 11:02:01 +0200 + grml-debootstrap (0.70) unstable; urgency=medium The 'contrib' and 'non-free' repositories are no longer diff --git a/grml-debootstrap b/grml-debootstrap index 103946cd..393380e1 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -79,6 +79,7 @@ MNTPOINT="/mnt/debootstrap.$$" [ -n "$TIMEZONE" ] || TIMEZONE='Europe/Vienna' [ -n "$TUNE2FS" ] || TUNE2FS='tune2fs -c0 -i0' [ -n "$UPGRADE_SYSTEM" ] || UPGRADE_SYSTEM='yes' +[ -n "$USE_DEFAULT_INTERFACES" ] || USE_DEFAULT_INTERFACES="true" [ -n "$VMSIZE" ] || VMSIZE="2G" [ -n "$GRUB_INSTALL" ] || GRUB_INSTALL='yes' @@ -141,11 +142,9 @@ Configuration options: --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. + --nointerfaces Skip installation of default network configuration. + --defaultinterfaces Install default network configuration. (default) + --hostinterfaces Copy host network configuration from host to target 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). @@ -347,7 +346,7 @@ fi # }}} # cmdline handling {{{ -CMDLINE_OPTS=mirror:,iso:,release:,target:,mntpoint:,debopt:,defaultinterfaces,interactive,nodebootstrap,nointerfaces,nokernel,nopackages,filesystem:,config:,confdir:,packages:,chroot-scripts:,scripts:,post-scripts:,pre-scripts:,debconf:,vm,vmfile,vmsize:,keep_src_list,hostname:,password:,nopassword,grmlrepos,backportrepos,bootappend:,grub:,efi:,arch:,insecure,verbose,help,version,force,debug,contrib,non-free,remove-configs,sshcopyid +CMDLINE_OPTS=mirror:,iso:,release:,target:,mntpoint:,debopt:,defaultinterfaces,hostinterfaces,interactive,nodebootstrap,nointerfaces,nokernel,nopackages,filesystem:,config:,confdir:,packages:,chroot-scripts:,scripts:,post-scripts:,pre-scripts:,debconf:,vm,vmfile,vmsize:,keep_src_list,hostname:,password:,nopassword,grmlrepos,backportrepos,bootappend:,grub:,efi:,arch:,insecure,verbose,help,version,force,debug,contrib,non-free,remove-configs,sshcopyid _opt_temp=$(getopt --name grml-debootstrap -o +m:i:r:t:p:c:d:vhV --long \ $CMDLINE_OPTS -- "$@") @@ -449,10 +448,13 @@ while :; do --password) # Use specified password as password for user root shift; _opt_password="$1" ;; - --defaultinterfaces) # Install default /etc/network/interfaces + --defaultinterfaces) # Install a default network configuration _opt_defaultinterfaces=T ;; - --nointerfaces) # Skip installation of /etc/network/interfaces + --hostinterfaces) # Copy host network configuration from host to target system + _opt_hostinterfaces=T + ;; + --nointerfaces) # Skip installation of default network configuration. _opt_nointerfaces=T ;; --nokernel) # Skip installation of default kernel images @@ -562,6 +564,7 @@ done [ "$_opt_password" ] && ROOTPASSWORD=$_opt_password [ "$_opt_nopassword" ] && NOPASSWORD='yes' [ "$_opt_defaultinterfaces" ] && USE_DEFAULT_INTERFACES="true" +[ "$_opt_hostinterfaces" ] && USE_HOST_INTERFACES="true" [ "$_opt_nointerfaces" ] && NOINTERFACES="true" [ "$_opt_nokernel" ] && NOKERNEL="true" [ "$_opt_sshcopyid" ] && SSHCOPYID="true" @@ -600,6 +603,24 @@ if [ -n "$ISO" ] && [[ "$DEBOOTSTRAP" =~ mmdebstrap$ ]] ; then bailout 1 fi +if [ "$_opt_defaultinterfaces" ] && [ "$_opt_hostinterfaces" ] ; then + eerror "The options --defaultinterfaces and --hostinterfaces conflict with each other, please drop one option from your command line." + eend 1 + bailout 1 +fi + +if [ "$_opt_defaultinterfaces" ] && [ "$_opt_nointerfaces" ] ; then + eerror "The options --defaultinterfaces and --nointerfaces conflict with each other, please drop one option from your command line." + eend 1 + bailout 1 +fi + +if [ "$_opt_nointerfaces" ] && [ "$_opt_hostinterfaces" ] ; then + eerror "The options --nointerfaces and --hostinterfaces conflict with each other, please drop one option from your command line." + eend 1 + bailout 1 +fi + if [ "$DEBUG" = "true" ] ; then set -x fi @@ -1713,6 +1734,16 @@ preparechroot() { [ -d "${CONFFILES}"/var ] && cp $VERBOSE -a -L "${CONFFILES}"/var/* "${MNTPOINT}"/var/ # network setup + + # systemd-networkd + DEFAULT_SYSTEMD_NETWORKD="# /etc/systemd/network/80-dhcp.network - generated by grml-debootstrap +[Match] +Name=en* + +[Network] +DHCP=yes +" + # legacy network interfaces DEFAULT_INTERFACES="# /etc/network/interfaces - generated by grml-debootstrap # Include files from /etc/network/interfaces.d when using @@ -1753,38 +1784,33 @@ iface ${interface} inet dhcp fi if [ -n "$NOINTERFACES" ] ; then - einfo "Not installing /etc/network/interfaces as requested via --nointerfaces option" ; eend 0 + einfo "Not installing default network configuration as requested via --nointerfaces option" + eend 0 elif [ -n "$USE_DEFAULT_INTERFACES" ] ; then - einfo "Installing default /etc/network/interfaces as requested via --defaultinterfaces options." + einfo "Installing default /etc/network/interfaces as requested via --defaultinterfaces option" mkdir -p "${MNTPOINT}/etc/network" echo "$DEFAULT_INTERFACES" > "${MNTPOINT}/etc/network/interfaces" eend $? - elif [ -n "$VIRTUAL" ] ; then - einfo "Setting up Virtual Machine, installing default /etc/network/interfaces" - mkdir -p "${MNTPOINT}/etc/network" - echo "$DEFAULT_INTERFACES" > "${MNTPOINT}/etc/network/interfaces" - eend $? - elif [ -r /etc/network/interfaces ] ; then - einfo "Copying /etc/network/interfaces from host to target system" - mkdir -p "${MNTPOINT}/etc/network" - cp $VERBOSE /etc/network/interfaces "${MNTPOINT}/etc/network/interfaces" + einfo "Installing default /etc/systemd/network/80-dhcp.network as requested via --defaultinterfaces option" + mkdir -p "${MNTPOINT}/etc/systemd/network" + echo "$DEFAULT_SYSTEMD_NETWORKD" > "${MNTPOINT}/etc/systemd/network/80-dhcp.network" eend $? - else - ewarn "Couldn't read /etc/network/interfaces, installing default /etc/network/interfaces" - mkdir -p "${MNTPOINT}/etc/network" - echo "$DEFAULT_INTERFACES" > "${MNTPOINT}/etc/network/interfaces" + elif [ -n "$USE_HOST_INTERFACES" ] ; then + if [ -r /etc/network/interfaces ] ; then + einfo "Copying /etc/network/interfaces from host to target system as requested via --hostinterfaces option" + mkdir -p "${MNTPOINT}/etc/network" + cp $VERBOSE /etc/network/interfaces "${MNTPOINT}/etc/network/interfaces" + elif ls /etc/systemd/network/* &>/dev/null ; then + einfo "Copy /etc/systemd/network/* from host to target system as requested via --hostinterfaces option" + mkdir -p "${MNTPOINT}/etc/systemd/network" + cp $VERBOSE /etc/systemd/network/* "${MNTPOINT}/etc/systemd/network" + fi eend $? fi - # install config file providing some example entries - if [ -r /etc/network/interfaces.examples ] && [ ! -r "$MNTPOINT/etc/network/interfaces.examples" ] ; then - mkdir -p "${MNTPOINT}/etc/network" - cp /etc/network/interfaces.examples "$MNTPOINT/etc/network/interfaces.examples" - fi - if [ -n "${SSHCOPYID}" ] ; then if ssh-add -L >/dev/null 2>&1 ; then - einfo "Use locally available public keys to authorise root login on the target system as requested via --sshcopyid option." + einfo "Use locally available public keys to authorise root login on the target system as requested via --sshcopyid option" mkdir -p "${MNTPOINT}"/root/.ssh chmod 0700 "${MNTPOINT}"/root/.ssh if ssh-add -L >> "${MNTPOINT}"/root/.ssh/authorized_keys ; then diff --git a/grml-debootstrap.8.txt b/grml-debootstrap.8.txt index 5f909bc3..68a9a786 100644 --- a/grml-debootstrap.8.txt +++ b/grml-debootstrap.8.txt @@ -80,16 +80,16 @@ Options and environment variables *--debug*:: - Execute in very verbose way. Useful for debugging possible problems - with grml-debootstrap or identify what's actually executed. + Execute in very verbose way. Useful for debugging possible problems + with grml-debootstrap or identify what's actually executed. *--defaultinterfaces*:: - Install a default /etc/network/interfaces file (enabling DHCP for all local - Ethernet, WLAN and WWAN interfaces using predictable network interface names - and using eth0 as traditional interface name for backward compatibility) - instead of taking over config from host system. - This option is automatically enabled when using --vm or --vmfile. + Install a default network configuration, that is a default + /etc/network/interfaces file (enabling DHCP for the first detected Ethernet + interfaces using predictable network interface names and using eth0 as + traditional interface name for backward compatibility). + This is the default and conflicts with --hostinterfaces and --nointerfaces. *--efi* _device_:: @@ -130,6 +130,13 @@ Options and environment variables Show summary of options and exit. +*--hostinterfaces*:: + + Copy host network configuration from host to target system, copying + /etc/network/interfaces and/or /etc/systemd/network/* if they exists. + This behavior used to be the default till grml-debootstrap v0.90. + Conflicts with --defaultinterfaces and --nointerfaces. + *--hostname* _hostname_:: Use specified hostname instead of the default (being $HOSTNAME or if unset 'grml'). @@ -157,7 +164,10 @@ Options and environment variables *--nointerfaces*:: - Do not copy /etc/network/interfaces from host system to the target. + Skip installation of a default network configuration. + Does neither provide a default /etc/systemd/network/80-dhcp.network nor + /etc/network/interfaces on the target system. + Conflicts with --defaultinterfaces and --hostinterfaces. *--nokernel*:: @@ -248,16 +258,14 @@ Options and environment variables partitioned. This allows deployment of a Virtual Machine. The options needs to be combined with the --target option. - This option automatically enables the --defaultinterfaces option. Usage example: --vm --target /dev/mapper/your-vm-disk *--vmfile*:: Set up a Virtual Machine using a regular file instead of installing to a partition/block device or directory. This allows deployment of a Virtual - Machine. The options needs to be combined with the --target option + Machine. ('qemu-img create -f raw ...' is executed on the specified target). - This option automatically enables the --defaultinterfaces option. Usage example: --vmfile --target /mnt/sda1/qemu.img *--vmsize* _size_:: @@ -278,9 +286,8 @@ docs and /etc/debootstrap/config for further information. Networking ---------- -By default (that is, if none of the options *--nointerfaces*, -*--defaultinterfaces*, *--vmfile* or *--vm* are given) /etc/network/interfaces -will be copied from the host to the target system. +By default a default network configuration is installed, see *--defaultinterfaces*. +To change the behavior, see *--nointerfaces* and *--hostinterfaces*. Usage examples ---------------