From 6bfcb080bf5b0eb0ed7bf9d908c298d664570bf1 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 11 Jun 2016 20:35:09 +0900 Subject: Exoscale.distroKernel --- src/Propellor/Property/HostingProvider/Exoscale.hs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/Propellor/Property/HostingProvider/Exoscale.hs (limited to 'src/Propellor/Property/HostingProvider/Exoscale.hs') diff --git a/src/Propellor/Property/HostingProvider/Exoscale.hs b/src/Propellor/Property/HostingProvider/Exoscale.hs new file mode 100644 index 00000000..afa3e1b7 --- /dev/null +++ b/src/Propellor/Property/HostingProvider/Exoscale.hs @@ -0,0 +1,23 @@ +-- | Maintainer: Sean Whitton + +module Propellor.Property.HostingProvider.Exoscale ( + distroKernel, +) where + +import Propellor.Base +import qualified Propellor.Property.Grub as Grub +import qualified Propellor.Property.Apt as Apt +import qualified Propellor.Property.Reboot as Reboot + +-- | Current Exoshare Debian image doesn't install GRUB, so this property makes +-- sure GRUB is installed and we're running the distro's kernel +-- +-- We reboot after doing this because 'Sbuild.built' will fail to set up an +-- overlay-type chroot on an old kernel +distroKernel :: Architecture -> Property DebianLike +distroKernel arch = Grub.installed' Grub.PC + `before` Apt.installed ["linux-image-" ++ arch] + `before` Grub.boots "/dev/vda" + `before` Grub.mkConfig + `before` Reboot.now + `flagFile` "/etc/propellor-grub" -- cgit v1.3-2-g0d8e From 11b82cdaf22402d500d82671fb26550137e8a168 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 11 Jun 2016 22:30:53 +0900 Subject: attempt to fix Exoscale.distroKernel flag file --- src/Propellor/Property/HostingProvider/Exoscale.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/Propellor/Property/HostingProvider/Exoscale.hs') diff --git a/src/Propellor/Property/HostingProvider/Exoscale.hs b/src/Propellor/Property/HostingProvider/Exoscale.hs index afa3e1b7..f7d676d0 100644 --- a/src/Propellor/Property/HostingProvider/Exoscale.hs +++ b/src/Propellor/Property/HostingProvider/Exoscale.hs @@ -15,9 +15,10 @@ import qualified Propellor.Property.Reboot as Reboot -- We reboot after doing this because 'Sbuild.built' will fail to set up an -- overlay-type chroot on an old kernel distroKernel :: Architecture -> Property DebianLike -distroKernel arch = Grub.installed' Grub.PC - `before` Apt.installed ["linux-image-" ++ arch] - `before` Grub.boots "/dev/vda" - `before` Grub.mkConfig - `before` Reboot.now - `flagFile` "/etc/propellor-grub" +distroKernel arch = combineProperties "boots distro kernel" $ props + & Grub.installed' Grub.PC + & Apt.installed ["linux-image-" ++ arch] + & Grub.boots "/dev/vda" + & flagFile + (Grub.mkConfig `before` Reboot.now) + "/etc/propellor-distro-kernel" -- cgit v1.3-2-g0d8e From 397204fb1910fad31ead2ed1ba1e226f088856c5 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 11 Jun 2016 23:00:39 +0900 Subject: include more in flag file --- src/Propellor/Property/HostingProvider/Exoscale.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/Propellor/Property/HostingProvider/Exoscale.hs') diff --git a/src/Propellor/Property/HostingProvider/Exoscale.hs b/src/Propellor/Property/HostingProvider/Exoscale.hs index f7d676d0..a123c54a 100644 --- a/src/Propellor/Property/HostingProvider/Exoscale.hs +++ b/src/Propellor/Property/HostingProvider/Exoscale.hs @@ -18,7 +18,9 @@ distroKernel :: Architecture -> Property DebianLike distroKernel arch = combineProperties "boots distro kernel" $ props & Grub.installed' Grub.PC & Apt.installed ["linux-image-" ++ arch] - & Grub.boots "/dev/vda" + -- only these ones are not idempotent so need flag file & flagFile - (Grub.mkConfig `before` Reboot.now) + (Grub.boots "/dev/vda" + `before` Grub.mkConfig + `before` Reboot.now) "/etc/propellor-distro-kernel" -- cgit v1.3-2-g0d8e From e20599639212ca6223f94a88dbff6641ed54234f Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 12 Jun 2016 09:47:23 +0900 Subject: re-organise Exoscale.distroKernel --- src/Propellor/Property/HostingProvider/Exoscale.hs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/Propellor/Property/HostingProvider/Exoscale.hs') diff --git a/src/Propellor/Property/HostingProvider/Exoscale.hs b/src/Propellor/Property/HostingProvider/Exoscale.hs index a123c54a..6bf19cbc 100644 --- a/src/Propellor/Property/HostingProvider/Exoscale.hs +++ b/src/Propellor/Property/HostingProvider/Exoscale.hs @@ -5,6 +5,7 @@ module Propellor.Property.HostingProvider.Exoscale ( ) where import Propellor.Base +import qualified Propellor.Property.File as File import qualified Propellor.Property.Grub as Grub import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.Reboot as Reboot @@ -15,12 +16,13 @@ import qualified Propellor.Property.Reboot as Reboot -- We reboot after doing this because 'Sbuild.built' will fail to set up an -- overlay-type chroot on an old kernel distroKernel :: Architecture -> Property DebianLike -distroKernel arch = combineProperties "boots distro kernel" $ props - & Grub.installed' Grub.PC - & Apt.installed ["linux-image-" ++ arch] - -- only these ones are not idempotent so need flag file - & flagFile - (Grub.boots "/dev/vda" - `before` Grub.mkConfig - `before` Reboot.now) - "/etc/propellor-distro-kernel" +distroKernel arch = go `flagFile` theFlagFile + where + go = combineProperties "boots distro kernel" $ props + & Apt.installed ["grub2", "linux-image-" ++ arch] + & Grub.boots "/dev/vda" + & Grub.mkConfig + -- Since we're rebooting we have to manually create the flagfile + & File.hasContent theFlagFile [""] + & Reboot.toDistroKernel + theFlagFile = "/etc/propellor-distro-kernel" -- cgit v1.3-2-g0d8e From 5e65dc8abe3237fdc189d8a80d3eb3e193369011 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 12 Jun 2016 13:34:23 +0900 Subject: improve Exoscale prop haddock --- src/Propellor/Property/HostingProvider/Exoscale.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/Propellor/Property/HostingProvider/Exoscale.hs') diff --git a/src/Propellor/Property/HostingProvider/Exoscale.hs b/src/Propellor/Property/HostingProvider/Exoscale.hs index 6bf19cbc..c6244d46 100644 --- a/src/Propellor/Property/HostingProvider/Exoscale.hs +++ b/src/Propellor/Property/HostingProvider/Exoscale.hs @@ -10,11 +10,15 @@ import qualified Propellor.Property.Grub as Grub import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.Reboot as Reboot --- | Current Exoshare Debian image doesn't install GRUB, so this property makes --- sure GRUB is installed and we're running the distro's kernel +-- | The current Exoshare Debian image doesn't install GRUB, so this property +-- makes sure GRUB is installed and correctly configured -- --- We reboot after doing this because 'Sbuild.built' will fail to set up an --- overlay-type chroot on an old kernel +-- In case an old, insecure kernel is running, we check for an old kernel +-- version and reboot immediately if one is found. +-- +-- Note that we ignore anything after the first hyphen when considering whether +-- the running kernel's version is older than the Debian-supplied kernel's +-- version. distroKernel :: Architecture -> Property DebianLike distroKernel arch = go `flagFile` theFlagFile where -- cgit v1.3-2-g0d8e