summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog4
-rw-r--r--joeyconfig.hs19
-rw-r--r--src/Propellor/Property/Partition.hs24
3 files changed, 25 insertions, 22 deletions
diff --git a/debian/changelog b/debian/changelog
index ed0e2422..9e6ffb67 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,7 +4,9 @@ propellor (4.0.2) UNRELEASED; urgency=medium
overriding the default CDN. This info is used by
Apt.stdSourcesList and Sbuild.builtFor.
Thanks, Sean Whitton.
-
+ * Property.Partition: Update kpartx output parser, as its output format
+ changed around version 0.6. Both output formats are supported now.
+
-- Joey Hess <id@joeyh.name> Sun, 19 Mar 2017 16:37:27 -0400
propellor (4.0.1) unstable; urgency=medium
diff --git a/joeyconfig.hs b/joeyconfig.hs
index 6fb05be1..3414d80e 100644
--- a/joeyconfig.hs
+++ b/joeyconfig.hs
@@ -126,18 +126,12 @@ clam = host "clam.kitenet.net" $ props
& Apt.unattendedUpgrades
& Network.ipv6to4
& Systemd.persistentJournal
- & Journald.systemMaxUse "500MiB"
+ & Journald.systemMaxUse "50MiB"
& Tor.isRelay
& Tor.named "kite1"
& Tor.bandwidthRate (Tor.PerMonth "400 GB")
- & Systemd.nspawned webserver
- & File.dirExists "/var/www/html"
- & File.notPresent "/var/www/index.html"
- & "/var/www/html/index.html" `File.hasContent` ["hello, world"]
- & alias "helloworld.kitenet.net"
-
& Systemd.nspawned oldusenetShellBox
& JoeySites.scrollBox
@@ -174,6 +168,7 @@ oyster = host "oyster.kitenet.net" $ props
& Network.ipv6to4
& Systemd.persistentJournal
& Journald.systemMaxUse "500MiB"
+ & Apt.serviceInstalledRunning "swapspace"
& Tor.isRelay
& Tor.named "kite4"
@@ -540,13 +535,6 @@ keysafe = host "keysafe.joeyh.name" $ props
--------------------------- \____, o ,' ----------------------------
---------------------------- '--,___________,' -----------------------------
--- Simple web server, publishing the outside host's /var/www
-webserver :: Systemd.Container
-webserver = Systemd.debContainer "webserver" $ props
- & standardContainer (Stable "jessie")
- & Systemd.bind "/var/www"
- & Apache.installed
-
-- My own openid provider. Uses php, so containerized for security
-- and administrative sanity.
openidProvider :: Systemd.Container
@@ -659,9 +647,6 @@ monsters = -- but do want to track their public keys etc.
& Ssh.hostPubKey SshEcdsa "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY="
, host "ns6.gandi.net" $ props
& ipv4 "217.70.177.40"
- , host "turtle.kitenet.net" $ props
- & ipv4 "67.223.19.96"
- & ipv6 "2001:4978:f:2d9::2"
, host "mouse.kitenet.net" $ props
& ipv6 "2001:4830:1600:492::2"
& ipv4 "67.223.19.96"
diff --git a/src/Propellor/Property/Partition.hs b/src/Propellor/Property/Partition.hs
index 2bf5b927..679675b7 100644
--- a/src/Propellor/Property/Partition.hs
+++ b/src/Propellor/Property/Partition.hs
@@ -9,6 +9,7 @@ import Utility.Applicative
import System.Posix.Files
import Data.List
+import Data.Char
-- | Filesystems etc that can be used for a partition.
data Fs = EXT2 | EXT3 | EXT4 | BTRFS | REISERFS | XFS | FAT | VFAT | NTFS | LinuxSwap
@@ -81,11 +82,26 @@ kpartx diskimage mkprop = go `requires` Apt.installed ["kpartx"]
return r
cleanup = void $ liftIO $ boolSystem "kpartx" [Param "-d", File diskimage]
+-- kpartx's output includes the device for the loop partition, and some
+-- information about the whole disk loop device. In earlier versions,
+-- this was simply the path to the loop device. But, in kpartx 0.6,
+-- this changed to the major:minor of the block device. Either is handled
+-- by this parser.
kpartxParse :: String -> [LoopDev]
kpartxParse = mapMaybe (finddev . words) . lines
where
- finddev ("add":"map":ld:_:_:_:_:wd:_) = Just $ LoopDev
- { partitionLoopDev = "/dev/mapper/" ++ ld
- , wholeDiskLoopDev = wd
- }
+ finddev ("add":"map":ld:_:_:_:_:s:_) = do
+ wd <- if isAbsolute s
+ then Just s
+ -- A loop partition name loop0pn corresponds to
+ -- /dev/loop0. It would be more robust to check
+ -- that the major:minor matches, but haskell's
+ -- unix library lacks a way to do that.
+ else case takeWhile isDigit (dropWhile (not . isDigit) ld) of
+ [] -> Nothing
+ n -> Just $ "/dev" </> "loop" ++ n
+ Just $ LoopDev
+ { partitionLoopDev = "/dev/mapper/" ++ ld
+ , wholeDiskLoopDev = wd
+ }
finddev _ = Nothing