Create hooks/artful with new 40-setup-networking-deb-netplan
Since Ubuntu 17.10 Artful, Ubuntu has decided to use netplan instead of ifupdown. 40-setup-networking-deb-netplan has been contributed by Arno and Peter. (see https://github.com/xen-tools/xen-tools/issues/51#issuecomment-412019510) Closes xen-tools/xen-tools#51. Since we have to make a variant of hooks/karmic/ as hook/artful/, rename hooks/karmic/80-install-kernel (which previously was unique to hooks/karmic/) to hooks/common/80-install-kernel-ubuntu and add symlinks to it from hooks/karmic/ and hook/artful/.
This commit is contained in:
11
Makefile
11
Makefile
@@ -219,11 +219,12 @@ install-hooks:
|
||||
-cd ${prefix}/usr/share/xen-tools/ && ln -s karmic.d xenial.d
|
||||
-cd ${prefix}/usr/share/xen-tools/ && ln -s karmic.d yakkety.d
|
||||
-cd ${prefix}/usr/share/xen-tools/ && ln -s karmic.d zesty.d
|
||||
-cd ${prefix}/usr/share/xen-tools/ && ln -s karmic.d artful.d
|
||||
-cd ${prefix}/usr/share/xen-tools/ && ln -s karmic.d bionic.d
|
||||
-cd ${prefix}/usr/share/xen-tools/ && ln -s karmic.d cosmic.d
|
||||
-cd ${prefix}/usr/share/xen-tools/ && ln -s karmic.d disco.d
|
||||
-cd ${prefix}/usr/share/xen-tools/ && ln -s karmic.d devel.d
|
||||
mkdir -p ${prefix}/usr/share/xen-tools/artful.d/
|
||||
cp -R hooks/karmic/*-* ${prefix}/usr/share/xen-tools/artful.d/
|
||||
-cd ${prefix}/usr/share/xen-tools/ && ln -s artful.d bionic.d
|
||||
-cd ${prefix}/usr/share/xen-tools/ && ln -s artful.d cosmic.d
|
||||
-cd ${prefix}/usr/share/xen-tools/ && ln -s artful.d disco.d
|
||||
-cd ${prefix}/usr/share/xen-tools/ && ln -s artful.d devel.d
|
||||
cp hooks/common.sh ${prefix}/usr/share/xen-tools
|
||||
cp -r hooks/common ${prefix}/usr/share/xen-tools
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ Distribution Releases Changes
|
||||
|
||||
* Support for
|
||||
+ Ubuntu 17.10 Artful Aardvark
|
||||
+ Ubuntu 18.04 Bionic Beaver (LTS)
|
||||
+ Ubuntu 18.04 Bionic Beaver (LTS) (GH #51)
|
||||
+ Ubuntu 18.10 Cosmic Cuttlefish
|
||||
* Preliminary support for Ubuntu 19.04 Disco Dingo
|
||||
* Knows about code name for Debian 12 (Bookworm).
|
||||
|
||||
4
debian/changelog
vendored
4
debian/changelog
vendored
@@ -11,6 +11,10 @@ xen-tools (4.8-1) UNRELEASED; urgency=medium
|
||||
[ Axel Beckert ]
|
||||
+ Add preliminary support for future Debian 12 Bookworm release.
|
||||
+ Add support for Ubuntu releases from 17.10 Artful to 19.04 Disco.
|
||||
- Create hooks/artful with new 40-setup-networking-deb-netplan by
|
||||
Arno Bakker and Peter. (Fixes xen-tools/xen-tools#51)
|
||||
- Rename hooks/karmic/80-install-kernel to
|
||||
hooks/common/80-install-kernel-ubu and add according symlinks.
|
||||
|
||||
[ Axel Beckert ]
|
||||
* Fix wrong bug number for #849867 in previous changelog entry.
|
||||
|
||||
1
hooks/artful/01-disable-daemons
Symbolic link
1
hooks/artful/01-disable-daemons
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/01-disable-daemons
|
||||
1
hooks/artful/05-shadowconfig-on
Symbolic link
1
hooks/artful/05-shadowconfig-on
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/05-shadowconfig-on
|
||||
1
hooks/artful/15-disable-hwclock
Symbolic link
1
hooks/artful/15-disable-hwclock
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/15-disable-hwclock
|
||||
1
hooks/artful/20-setup-apt
Symbolic link
1
hooks/artful/20-setup-apt
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/20-setup-apt
|
||||
1
hooks/artful/25-generate-locale
Symbolic link
1
hooks/artful/25-generate-locale
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/25-generate-locale
|
||||
1
hooks/artful/30-disable-gettys
Symbolic link
1
hooks/artful/30-disable-gettys
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/30-disable-gettys
|
||||
1
hooks/artful/35-setup-users
Symbolic link
1
hooks/artful/35-setup-users
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/35-setup-users
|
||||
128
hooks/artful/40-setup-networking-deb-netplan
Executable file
128
hooks/artful/40-setup-networking-deb-netplan
Executable file
@@ -0,0 +1,128 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This script sets up the /etc/netplan/interface file for the new
|
||||
# image.
|
||||
#
|
||||
# Steve
|
||||
# --
|
||||
# https://steve.fi/
|
||||
|
||||
|
||||
prefix=$1
|
||||
|
||||
#
|
||||
# Source our common functions
|
||||
#
|
||||
if [ -e /usr/share/xen-tools/common.sh ]; then
|
||||
. /usr/share/xen-tools/common.sh
|
||||
else
|
||||
. ./hooks/common.sh
|
||||
fi
|
||||
|
||||
# From: https://serverfault.com/questions/54981/linux-command-line-tool-to-work-with-netmasks-cidr-notation
|
||||
mask2cdr ()
|
||||
{
|
||||
# Assumes there's no "255." after a non-255 byte in the mask
|
||||
local x=${1##*255.}
|
||||
set -- 0^^^128^192^224^240^248^252^254^ $(( (${#1} - ${#x})*2 )) ${x%%.*}
|
||||
x=${1%%$3*}
|
||||
echo $(( $2 + (${#x}/4) ))
|
||||
}
|
||||
|
||||
#
|
||||
# Log our start
|
||||
#
|
||||
logMessage Script $0 starting
|
||||
|
||||
|
||||
#
|
||||
# Make sure we have an /etc/netplan directory.
|
||||
#
|
||||
mkdir -p ${prefix}/etc/netplan
|
||||
|
||||
|
||||
#
|
||||
# A function to setup DHCP for our new image.
|
||||
#
|
||||
setupDynamicNetworking ()
|
||||
{
|
||||
#
|
||||
# The host is using DHCP.
|
||||
#
|
||||
cat <<E_O_DHCP > ${prefix}/etc/netplan/01-netcfg.yaml
|
||||
# Arno: Configure VM interface eth0 via DHCP
|
||||
network:
|
||||
version: 2
|
||||
renderer: networkd
|
||||
ethernets:
|
||||
eth0:
|
||||
dhcp4: true
|
||||
E_O_DHCP
|
||||
}
|
||||
|
||||
|
||||
|
||||
#
|
||||
# A function to setup static IP addresses for our new image.
|
||||
#
|
||||
setupStaticNetworking ()
|
||||
{
|
||||
# Arno
|
||||
cidr='24';
|
||||
if [ -n "${netmask}" ]; then
|
||||
cidr="$(mask2cdr ${netmask})"
|
||||
fi
|
||||
|
||||
#
|
||||
# We have a static IP address
|
||||
#
|
||||
cat <<E_O_STATIC >${prefix}/etc/netplan/01-netcfg.yaml
|
||||
# Arno: Set static IP for VM interface eth0
|
||||
network:
|
||||
version: 2
|
||||
renderer: networkd
|
||||
ethernets:
|
||||
eth0:
|
||||
addresses: [${ip1}/${cidr}]
|
||||
gateway4: ${gateway}
|
||||
nameservers:
|
||||
addresses: [${nameserver}]
|
||||
E_O_STATIC
|
||||
|
||||
# Arno: no support for multiple interfaces
|
||||
|
||||
#
|
||||
# Hooks are run chrooted, hence the resolv.conf is moved
|
||||
# temporarily to /etc/resolv.conf.old. Use that file, it
|
||||
# will be restored after hooks are run.
|
||||
#
|
||||
if [ '' != "$nameserver" ]; then
|
||||
rm -f ${prefix}/etc/resolv.conf.old
|
||||
for ns in $nameserver; do
|
||||
echo "nameserver $ns" >>${prefix}/etc/resolv.conf.old
|
||||
done
|
||||
else
|
||||
cp /etc/resolv.conf ${prefix}/etc/resolv.conf.old
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Call the relevant function
|
||||
#
|
||||
if [ -z "${dhcp}" ]; then
|
||||
logMessage "Setting up static networking"
|
||||
setupStaticNetworking
|
||||
|
||||
else
|
||||
logMessage "Setting up DHCP networking"
|
||||
setupDynamicNetworking
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Log our finish
|
||||
#
|
||||
logMessage Script $0 finished
|
||||
1
hooks/artful/50-setup-hostname
Symbolic link
1
hooks/artful/50-setup-hostname
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/50-setup-hostname-deb
|
||||
1
hooks/artful/60-copy-host-files
Symbolic link
1
hooks/artful/60-copy-host-files
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/60-copy-host-files
|
||||
1
hooks/artful/65-copy-user-files
Symbolic link
1
hooks/artful/65-copy-user-files
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/65-copy-user-files
|
||||
1
hooks/artful/70-install-ssh
Symbolic link
1
hooks/artful/70-install-ssh
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/70-install-ssh-deb
|
||||
1
hooks/artful/75-fixup-securetty
Symbolic link
1
hooks/artful/75-fixup-securetty
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/75-fixup-securetty
|
||||
1
hooks/artful/80-install-kernel-ubuntu
Symbolic link
1
hooks/artful/80-install-kernel-ubuntu
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/80-install-kernel-ubuntu
|
||||
1
hooks/artful/80-install-modules
Symbolic link
1
hooks/artful/80-install-modules
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/80-install-modules-deb
|
||||
1
hooks/artful/81-install-modules-init-tools
Symbolic link
1
hooks/artful/81-install-modules-init-tools
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/81-install-modules-init-tools
|
||||
1
hooks/artful/82-install-grub-legacy
Symbolic link
1
hooks/artful/82-install-grub-legacy
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/82-install-grub-legacy
|
||||
1
hooks/artful/90-make-fstab
Symbolic link
1
hooks/artful/90-make-fstab
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/90-make-fstab
|
||||
1
hooks/artful/99-clean-image
Symbolic link
1
hooks/artful/99-clean-image
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/99-clean-image-deb
|
||||
1
hooks/artful/99-enable-daemons
Symbolic link
1
hooks/artful/99-enable-daemons
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/99-enable-daemons
|
||||
1
hooks/karmic/80-install-kernel-ubuntu
Symbolic link
1
hooks/karmic/80-install-kernel-ubuntu
Symbolic link
@@ -0,0 +1 @@
|
||||
../common/80-install-kernel-ubuntu
|
||||
Reference in New Issue
Block a user