summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton2016-06-19 20:27:28 +0900
committerSean Whitton2016-06-19 20:27:28 +0900
commit1a84be997bd9bacc632b0965f965557f7c10e686 (patch)
treee2473c48d9251e52e531480659ffe9f3e6f2bf7d
parentcb6503bfa32365b96a6b676eb4d0074df2601554 (diff)
Schroot.overlaysInTmpfs sets Schroot.useOverlays
-rw-r--r--src/Propellor/Property/Schroot.hs47
1 files changed, 25 insertions, 22 deletions
diff --git a/src/Propellor/Property/Schroot.hs b/src/Propellor/Property/Schroot.hs
index 0e683562..0e52f1a4 100644
--- a/src/Propellor/Property/Schroot.hs
+++ b/src/Propellor/Property/Schroot.hs
@@ -27,32 +27,35 @@ usesOverlays = isJust . fromInfoVal
-- | Configure schroot such that all schroots with @union-type=overlay@ in their
-- configuration will run their overlays in a tmpfs.
--
+-- Implicitly sets 'useOverlays' info property.
+--
-- Shell script from <https://wiki.debian.org/sbuild>.
-overlaysInTmpfs :: Property DebianLike
+overlaysInTmpfs :: Property (HasInfo + DebianLike)
overlaysInTmpfs = go `requires` installed
where
f = "/etc/schroot/setup.d/04tmpfs"
- go :: Property UnixLike
- go = f `File.hasContent`
- [ "#!/bin/sh"
- , ""
- , "set -e"
- , ""
- , ". \"$SETUP_DATA_DIR/common-data\""
- , ". \"$SETUP_DATA_DIR/common-functions\""
- , ". \"$SETUP_DATA_DIR/common-config\""
- , ""
- , ""
- , "if [ $STAGE = \"setup-start\" ]; then"
- , " mount -t tmpfs overlay /var/lib/schroot/union/overlay"
- , "elif [ $STAGE = \"setup-recover\" ]; then"
- , " mount -t tmpfs overlay /var/lib/schroot/union/overlay"
- , "elif [ $STAGE = \"setup-stop\" ]; then"
- , " umount -f /var/lib/schroot/union/overlay"
- , "fi"
- ]
- `onChange` (f `File.mode` (combineModes (readModes ++ executeModes)))
- `describe` "schroot overlays in tmpfs"
+ go :: Property (HasInfo + UnixLike)
+ go = combineProperties "schroot overlays in tmpfs" $ props
+ & useOverlays
+ & f `File.hasContent`
+ [ "#!/bin/sh"
+ , ""
+ , "set -e"
+ , ""
+ , ". \"$SETUP_DATA_DIR/common-data\""
+ , ". \"$SETUP_DATA_DIR/common-functions\""
+ , ". \"$SETUP_DATA_DIR/common-config\""
+ , ""
+ , ""
+ , "if [ $STAGE = \"setup-start\" ]; then"
+ , " mount -t tmpfs overlay /var/lib/schroot/union/overlay"
+ , "elif [ $STAGE = \"setup-recover\" ]; then"
+ , " mount -t tmpfs overlay /var/lib/schroot/union/overlay"
+ , "elif [ $STAGE = \"setup-stop\" ]; then"
+ , " umount -f /var/lib/schroot/union/overlay"
+ , "fi"
+ ]
+ `onChange` (f `File.mode` combineModes (readModes ++ executeModes))
installed :: Property DebianLike
installed = Apt.installed ["schroot"]