From 718c2bb387e83aa05169ff7c09f4600577941b20 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 16 May 2016 10:29:02 -0700 Subject: add Schroot.hs --- src/Propellor/Property/Schroot.hs | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/Propellor/Property/Schroot.hs (limited to 'src/Propellor') diff --git a/src/Propellor/Property/Schroot.hs b/src/Propellor/Property/Schroot.hs new file mode 100644 index 00000000..8e6ce4e6 --- /dev/null +++ b/src/Propellor/Property/Schroot.hs @@ -0,0 +1,41 @@ +-- | Maintainer: Sean Whitton + +module Propellor.Property.Schroot where + +import Propellor.Base +import qualified Propellor.Property.File as File +import qualified Propellor.Property.Apt as Apt + +import Utility.FileMode + +-- | Configure schroot such that all schroots with @union-type=overlay@ in their +-- configuration will run their overlays in a tmpfs. +-- +-- Shell script from . +overlaysInTmpfs :: Property 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))) + +installed :: Property DebianLike +installed = Apt.installed ["schroot"] -- cgit v1.2.3