From 1a84be997bd9bacc632b0965f965557f7c10e686 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 19 Jun 2016 20:27:28 +0900 Subject: Schroot.overlaysInTmpfs sets Schroot.useOverlays --- src/Propellor/Property/Schroot.hs | 47 +++++++++++++++++++++------------------ 1 file 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 . -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"] -- cgit v1.2.3