From 4360ad5ca703c99723c72d16e0da3f4ca92f92d9 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 8 Jun 2021 14:59:51 -0700 Subject: add properties to build and configure sbuild schroots Based on properties I wrote for Propellor. Signed-off-by: Sean Whitton --- src/property/schroot.lisp | 65 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/property/schroot.lisp (limited to 'src/property/schroot.lisp') diff --git a/src/property/schroot.lisp b/src/property/schroot.lisp new file mode 100644 index 0000000..2e6cb40 --- /dev/null +++ b/src/property/schroot.lisp @@ -0,0 +1,65 @@ +;;; Consfigurator -- Lisp declarative configuration management system + +;;; Copyright (C) 2016, 2021 Sean Whitton + +;;; This file is free software; you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3, or (at your option) +;;; any later version. + +;;; This file is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. + +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see . + +(in-package :consfigurator.property.schroot) +(named-readtables:in-readtable :consfigurator) + +(defproplist installed :posix () + "Ensure that schroot(1) is installed." + (:desc "schroot(1) installed") + (os:etypecase + (debianlike (apt:installed "schroot")))) + +(defprop uses-overlays :posix () + "Indicate that schroots on a host should use 'union-type=overlay'. + +Adding this property does not actually ensure that the line +'union-type=overlay' is present in any schroot config files. See SBUILD:BUILT +for example usage, via SCHROOT:OVERLAYS-IN-TMPFS." + (:desc "schroots on host use union-type=overlay") + (:hostattrs (push-hostattrs 'uses-overlays t))) + +(defprop overlays-in-tmpfs :posix () + "Configure schroot(1) such that all schroots with 'union-type=overlay' in +their configuration will run their overlays in a tmpfs. Unapplicable, so if +the package you are working on FTBFS when overlays are in tmpfs, you can +toggle this off for a host, and then toggle it back on again later. + +Implicitly sets SCHROOT:USES-OVERLAYS. + +Shell script from ." + (:desc "schroot overlays in tmpfs") + (:hostattrs (push-hostattrs 'uses-overlays t)) + (:apply (file:has-content "/etc/schroot/setup.d/04tmpfs" +#>EOF>#!/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 +EOF :mode #o755)) + (:unapply (file:does-not-exist "/etc/schroot/setup.d/04tmpfs"))) -- cgit v1.2.3