From 831a64393e1a0440efa3890410ff61ad908de6bd Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Fri, 9 Aug 2019 09:16:09 -0400 Subject: Cirrus: disable Evil Units in base-images Also, minor update to prevent harmless 'Fatal: not a git repo' error. Signed-off-by: Chris Evich --- contrib/cirrus/packer/systemd_banish.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 contrib/cirrus/packer/systemd_banish.sh (limited to 'contrib/cirrus/packer/systemd_banish.sh') diff --git a/contrib/cirrus/packer/systemd_banish.sh b/contrib/cirrus/packer/systemd_banish.sh new file mode 100755 index 000000000..396cf906c --- /dev/null +++ b/contrib/cirrus/packer/systemd_banish.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set +e # Not all of these exist on every platform + +# This is intended to be executed on VMs as a startup script on initial-boot. +# Alternativly, it may be executed with the '--list' option to return the list +# of systemd units defined for disablement (useful for testing). + +EVIL_UNITS="cron crond atd apt-daily-upgrade apt-daily fstrim motd-news systemd-tmpfiles-clean" + +if [[ "$1" == "--list" ]] +then + echo "$EVIL_UNITS" + exit 0 +fi + +echo "Disabling periodic services that could destabilize testing:" +for unit in $EVIL_UNITS +do + echo "Banishing $unit (ignoring errors)" + ( + sudo systemctl stop $unit + sudo systemctl disable $unit + sudo systemctl disable $unit.timer + sudo systemctl mask $unit + sudo systemctl mask $unit.timer + ) &> /dev/null +done -- cgit v1.2.3-54-g00ecf