diskimage-builder/diskimage_builder/elements/growvols/post-install.d/80-growvols
Ramil Minishev a27de3f8a2 Make growvols config path platform independent
Change-Id: I9b8fdf96c8543bff92019fb82f10493de7728a26
2022-02-04 00:23:13 +03:00

30 lines
684 B
Bash
Executable File

#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
case ${DIB_GROWVOLS_TRIGGER} in
manual) echo "growvols triggered manually after boot"; exit ;;
systemd) echo "growvols triggered by systemd" ;;
*) echo "Unsupported DIB_GROWVOLS_TRIGGER: ${DIB_GROWVOLS_TRIGGER}"; exit 1 ;;
esac
cat << EOF | sudo tee /etc/default/growvols > /dev/null
GROWVOLS_ARGS="${DIB_GROWVOLS_ARGS}"
GROWVOLS_GROUP="${DIB_GROWVOLS_GROUP}"
GROWVOLS_DEVICE="${DIB_GROWVOLS_DEVICE}"
EOF
case "$DIB_INIT_SYSTEM" in
systemd)
systemctl enable growvols.service
;;
*)
echo "Unsupported init system"
exit 1
;;
esac