From 31db9fc57d8413c3c606ab428b2d17814f25e3a8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 23 Oct 2015 01:41:08 -0400 Subject: propellor spin --- config-joey.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'config-joey.hs') diff --git a/config-joey.hs b/config-joey.hs index 21d7194f..ca1e0ef7 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -82,9 +82,11 @@ darkstar = host "darkstar.kitenet.net" & JoeySites.dkimMilter & imageBuilt "/tmp/img" c MSDOS (grubBooted PC) - [ partition EXT4 `mountedAt` "/" + [ partition EXT4 `mountedAt` "/boot" `addFreeSpace` MegaBytes 100 `setFlag` BootFlag + , partition EXT4 `mountedAt` "/" + `addFreeSpace` MegaBytes 100 , swapPartition (MegaBytes 256) ] where -- cgit v1.3-2-g0d8e From 3c9fc8288f960afc629ce55bc86e615b068d8cc9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 23 Oct 2015 01:45:44 -0400 Subject: propellor spin --- config-joey.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config-joey.hs') diff --git a/config-joey.hs b/config-joey.hs index ca1e0ef7..ab7f2c9d 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -82,7 +82,7 @@ darkstar = host "darkstar.kitenet.net" & JoeySites.dkimMilter & imageBuilt "/tmp/img" c MSDOS (grubBooted PC) - [ partition EXT4 `mountedAt` "/boot" + [ partition EXT2 `mountedAt` "/boot" `addFreeSpace` MegaBytes 100 `setFlag` BootFlag , partition EXT4 `mountedAt` "/" -- cgit v1.3-2-g0d8e From a1a79784c892c9fb5370c4283be7d6adbc0cf46a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 23 Oct 2015 01:48:13 -0400 Subject: propellor spin --- config-joey.hs | 1 - 1 file changed, 1 deletion(-) (limited to 'config-joey.hs') diff --git a/config-joey.hs b/config-joey.hs index ab7f2c9d..81e97af4 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -83,7 +83,6 @@ darkstar = host "darkstar.kitenet.net" & imageBuilt "/tmp/img" c MSDOS (grubBooted PC) [ partition EXT2 `mountedAt` "/boot" - `addFreeSpace` MegaBytes 100 `setFlag` BootFlag , partition EXT4 `mountedAt` "/" `addFreeSpace` MegaBytes 100 -- cgit v1.3-2-g0d8e From 2e42b9db53ecf8cc33d92e2374e0d5ca24013a85 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 23 Oct 2015 11:42:59 -0400 Subject: propellor spin --- config-joey.hs | 1 + src/Propellor/Property/DiskImage.hs | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'config-joey.hs') diff --git a/config-joey.hs b/config-joey.hs index 81e97af4..6ec80f92 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -91,6 +91,7 @@ darkstar = host "darkstar.kitenet.net" where c d = Chroot.debootstrapped (System (Debian Unstable) "amd64") mempty d & Apt.installed ["linux-image-amd64"] + & User "root" `User.hasInsecurePassword` "root" gnu :: Host gnu = host "gnu.kitenet.net" diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs index 56ee2a8c..af8a020b 100644 --- a/src/Propellor/Property/DiskImage.hs +++ b/src/Propellor/Property/DiskImage.hs @@ -47,7 +47,7 @@ import Propellor.Property.Partition import Propellor.Property.Rsync import Utility.Path -import Data.List (isPrefixOf, sortBy) +import Data.List (isPrefixOf, isInfixOf, sortBy) import Data.Function (on) import qualified Data.Map.Strict as M import qualified Data.ByteString.Lazy as L @@ -309,6 +309,10 @@ imageFinalized (_, final) mnts devs (PartTable _ parts) = -- comes before /usr/local orderedmntsdevs :: [(Maybe MountPoint, LoopDev)] orderedmntsdevs = sortBy (compare `on` fst) $ zip mnts devs + + swaps = map (SwapPartition . partitionLoopDev . snd) $ + filter ((== LinuxSwap) . partFs . fst) $ + zip parts devs mountall top = forM_ orderedmntsdevs $ \(mp, loopdev) -> case mp of Nothing -> noop @@ -323,13 +327,13 @@ imageFinalized (_, final) mnts devs (PartTable _ parts) = umountLazy top writefstab top = do - old <- catchDefaultIO "" $ readFileStrict "/etc/fstab" + old <- catchDefaultIO [] $ filter (not . unconfigured) . lines + <$> readFileStrict (top ++ "/etc/fstab") new <- genFstab (map (top ++) (catMaybes mnts)) swaps (toSysDir top) - writeFile "/etc/fstab" (unlines new ++ old) - swaps = map (SwapPartition . partitionLoopDev . snd) $ - filter ((== LinuxSwap) . partFs . fst) $ - zip parts devs + writeFile "/etc/fstab" $ unlines $ new ++ old + -- Eg "UNCONFIGURED FSTAB FOR BASE SYSTEM" + unconfigured s = "UNCONFIGURED" `isInfixOf` s noFinalization :: Finalization noFinalization = (doNothing, \_ _ -> doNothing) -- cgit v1.3-2-g0d8e From a1183efbcb6a2a3f62027aa452c99ac3be17c6b8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 23 Oct 2015 11:51:14 -0400 Subject: propellor spin --- config-joey.hs | 3 ++- src/Propellor/Property/Mount.hs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'config-joey.hs') diff --git a/config-joey.hs b/config-joey.hs index 6ec80f92..ceabc252 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -84,8 +84,9 @@ darkstar = host "darkstar.kitenet.net" & imageBuilt "/tmp/img" c MSDOS (grubBooted PC) [ partition EXT2 `mountedAt` "/boot" `setFlag` BootFlag + `addFreeSpace` MegaBytes 200 , partition EXT4 `mountedAt` "/" - `addFreeSpace` MegaBytes 100 + `addFreeSpace` MegaBytes 200 , swapPartition (MegaBytes 256) ] where diff --git a/src/Propellor/Property/Mount.hs b/src/Propellor/Property/Mount.hs index 2496b1cc..a08f9e3b 100644 --- a/src/Propellor/Property/Mount.hs +++ b/src/Propellor/Property/Mount.hs @@ -150,7 +150,7 @@ findmntField field mnt = catchDefaultIO Nothing $ blkidTag :: String -> Source -> IO (Maybe String) blkidTag tag dev = catchDefaultIO Nothing $ headMaybe . filter (not . null) . lines - <$> readProcess "blkid" [dev, "-s", tag] + <$> readProcess "blkid" [dev, "-s", tag, "-o", "value"] -- | Unmounts a device or mountpoint, -- lazily so any running processes don't block it. -- cgit v1.3-2-g0d8e From 02faa876dbf3000fb091be6a4a3ab5b6a26ed028 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 23 Oct 2015 11:59:13 -0400 Subject: propellor spin --- config-joey.hs | 4 ++-- src/Propellor/Property/DiskImage.hs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'config-joey.hs') diff --git a/config-joey.hs b/config-joey.hs index ceabc252..9148fe4e 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -84,9 +84,9 @@ darkstar = host "darkstar.kitenet.net" & imageBuilt "/tmp/img" c MSDOS (grubBooted PC) [ partition EXT2 `mountedAt` "/boot" `setFlag` BootFlag - `addFreeSpace` MegaBytes 200 + -- `addFreeSpace` MegaBytes 200 , partition EXT4 `mountedAt` "/" - `addFreeSpace` MegaBytes 200 + -- `addFreeSpace` MegaBytes 200 , swapPartition (MegaBytes 256) ] where diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs index 607c7b61..b6cfbc1a 100644 --- a/src/Propellor/Property/DiskImage.hs +++ b/src/Propellor/Property/DiskImage.hs @@ -352,6 +352,7 @@ grubBooted bios = (Grub.installed' bios, boots) [ bindMount "/dev" (inmnt "/dev") , mounted "proc" "proc" (inmnt "/proc") , mounted "sysfs" "sys" (inmnt "/sys") + -- update the initramfs so it gets the uuid of the root partition , inchroot "update-initramfs" ["-u"] -- work around for http://bugs.debian.org/802717 , check haveosprober $ inchroot "chmod" ["-x", osprober] -- cgit v1.3-2-g0d8e From 72f956788ef144a3a516e759335d2e7fbc6931ec Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 23 Oct 2015 12:04:03 -0400 Subject: propellor spin --- config-joey.hs | 2 -- src/Propellor/Property/DiskImage.hs | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'config-joey.hs') diff --git a/config-joey.hs b/config-joey.hs index 9148fe4e..fce4f7a1 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -84,9 +84,7 @@ darkstar = host "darkstar.kitenet.net" & imageBuilt "/tmp/img" c MSDOS (grubBooted PC) [ partition EXT2 `mountedAt` "/boot" `setFlag` BootFlag - -- `addFreeSpace` MegaBytes 200 , partition EXT4 `mountedAt` "/" - -- `addFreeSpace` MegaBytes 200 , swapPartition (MegaBytes 256) ] where diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs index b6cfbc1a..19c3a545 100644 --- a/src/Propellor/Property/DiskImage.hs +++ b/src/Propellor/Property/DiskImage.hs @@ -227,9 +227,10 @@ defSz = MegaBytes 128 -- Add 2% for filesystem overhead. Rationalle for picking 2%: -- A filesystem with 1% overhead might just sneak by as acceptable. -- Double that just in case. Add an additional 3 mb to deal with --- non-scaling overhead, of filesystems (eg, superblocks). +-- non-scaling overhead of filesystems (eg, superblocks). +-- Add an additional 100 mb for temp files etc. fudge :: PartSize -> PartSize -fudge (MegaBytes n) = MegaBytes (n + n `div` 100 * 2 + 3) +fudge (MegaBytes n) = MegaBytes (n + n `div` 100 * 2 + 3 + 100) -- | Specifies a mount point and a constructor for a Partition. -- -- cgit v1.3-2-g0d8e