From 348867ff6a84958a2388799fa702396c16c2ae9f Mon Sep 17 00:00:00 2001 From: Markus Koller Date: Wed, 6 Jul 2016 10:15:34 +0200 Subject: [PATCH 1/5] Correctly set hostname in preos --- cdist/preos.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/preos.py b/cdist/preos.py index b61318ed..8a17974e 100644 --- a/cdist/preos.py +++ b/cdist/preos.py @@ -63,7 +63,7 @@ eof # fix the bloody 'stdin: is not a tty' problem __line /root/.profile --line 'mesg n' --state absent -__hostname preos +__hostname --name preos """ class PreOSExistsError(cdist.Error): From 78d7d91e42dc7bcbc882eaf735fe48e3714c7f6d Mon Sep 17 00:00:00 2001 From: Markus Koller Date: Wed, 6 Jul 2016 10:30:13 +0200 Subject: [PATCH 2/5] Install lsb-release in preos Several types use the lsb_release command to determine the distribution, if this command is missing unexpected things will happen. --- cdist/preos.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cdist/preos.py b/cdist/preos.py index 8a17974e..df5be1fa 100644 --- a/cdist/preos.py +++ b/cdist/preos.py @@ -38,6 +38,7 @@ DEFAULT_MANIFEST = """ for pkg in \ file \ linux-image-amd64 \ + lsb-release \ openssh-server curl \ syslinux grub2 \ gdisk util-linux lvm2 mdadm \ From 0e114c37ac1756d916a393822a8744eba5d55eb0 Mon Sep 17 00:00:00 2001 From: Markus Koller Date: Wed, 6 Jul 2016 10:47:28 +0200 Subject: [PATCH 3/5] Always use current stable release for preos --- cdist/preos.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/preos.py b/cdist/preos.py index df5be1fa..8eced936 100644 --- a/cdist/preos.py +++ b/cdist/preos.py @@ -86,7 +86,7 @@ class PreOS(object): self.arch = arch self.command = "debootstrap" - self.suite = "wheezy" + self.suite = "stable" self.options = [ "--include=openssh-server", "--arch=%s" % self.arch ] From e79610f23c585017da411eea0a5d76b9876eacc4 Mon Sep 17 00:00:00 2001 From: Markus Koller Date: Wed, 6 Jul 2016 11:22:15 +0200 Subject: [PATCH 4/5] Don't try to use hostnamectl when systemd isn't running --- cdist/conf/type/__hostname/explorer/has_hostnamectl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__hostname/explorer/has_hostnamectl b/cdist/conf/type/__hostname/explorer/has_hostnamectl index 9040023d..7e8a57fd 100755 --- a/cdist/conf/type/__hostname/explorer/has_hostnamectl +++ b/cdist/conf/type/__hostname/explorer/has_hostnamectl @@ -18,7 +18,12 @@ # along with cdist. If not, see . # # -# Check whether system has hostnamectl +# Check whether system has hostnamectl and it's usable, i.e. don't +# try to use it when systemd isn't running yet. # -command -v hostnamectl || true +if command -v hostnamectl >/dev/null && hostnamectl status >/dev/null 2>&1; then + echo "yes" +else + true +fi From 16cb3a5ff11bae3f0f99e477bcfe202599a21119 Mon Sep 17 00:00:00 2001 From: Markus Koller Date: Wed, 6 Jul 2016 14:57:59 +0200 Subject: [PATCH 5/5] Update PXE setup for Debian 8 --- cdist/preos.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cdist/preos.py b/cdist/preos.py index 8eced936..c21dc00a 100644 --- a/cdist/preos.py +++ b/cdist/preos.py @@ -40,7 +40,7 @@ for pkg in \ linux-image-amd64 \ lsb-release \ openssh-server curl \ - syslinux grub2 \ + pxelinux syslinux-common grub2 \ gdisk util-linux lvm2 mdadm \ btrfs-tools e2fsprogs jfsutils reiser4progs xfsprogs; do __package $pkg --state present @@ -90,7 +90,7 @@ class PreOS(object): self.options = [ "--include=openssh-server", "--arch=%s" % self.arch ] - self.pxelinux = "/usr/lib/syslinux/pxelinux.0" + self.pxelinux = "/usr/lib/PXELINUX/pxelinux.0" self.pxelinux_cfg = """ DEFAULT preos LABEL preos @@ -178,11 +178,18 @@ cp -L "$src" "$real_dst" def create_pxelinux(self): dst = os.path.join(self.out_dir, "pxelinux.0") - src = "%s/usr/lib/syslinux/pxelinux.0" % self.target_dir + src = "%s/usr/lib/PXELINUX/pxelinux.0" % self.target_dir log.info("Creating pxelinux.0 ...") shutil.copyfile(src, dst, follow_symlinks=True) + def create_ldlinux(self): + dst = os.path.join(self.out_dir, "ldlinux.c32") + src = "%s/usr/lib/syslinux/modules/bios/ldlinux.c32" % self.target_dir + + log.info("Creating ldlinux.c32 ...") + shutil.copyfile(src, dst, follow_symlinks=True) + def create_pxeconfig(self): configdir = os.path.join(self.out_dir, "pxelinux.cfg") configfile = os.path.join(configdir, "default") @@ -219,6 +226,7 @@ cp -L "$src" "$real_dst" self.create_initramfs() self.create_pxeconfig() self.create_pxelinux() + self.create_ldlinux() def setup_initial_manifest(self, user_initial_manifest, replace_manifest):