particle-os-modules/modules/systemd/systemd.sh
xyny 7c4dd1553e
feat: startingpoint modules (#33)
* feat: add startingpoint modules
some modules authored by @gerblesh
original source: https://github.com/ublue-os/startingpoint/pull/135

* docs: better readme for modules dir

* docs: yafti deps

* docs: sp more information

* feat: startingpoint modules in container

* docs: sentence structure, check sidebar
2023-09-10 14:29:26 +00:00

35 lines
912 B
Bash

#!/usr/bin/env bash
# Tell build process to exit if there are any errors.
set -oue pipefail
get_yaml_array ENABLED '.system.enabled[]' "$1"
get_yaml_array DISABLED '.system.disabled[]' "$1"
get_yaml_array USER_ENABLED '.user.enabled[]' "$1"
get_yaml_array USER_DISABLED '.user.disabled[]' "$1"
if [[ ${#ENABLED[@]} -gt 0 ]]; then
for unit in "${ENABLED[@]}"; do
unit=$(printf "$unit")
systemctl enable $unit
done
fi
if [[ ${#DISABLED[@]} -gt 0 ]]; then
for unit in "${DISABLED[@]}"; do
unit=$(printf "$unit")
systemctl disable $unit
done
fi
if [[ ${#USER_ENABLED[@]} -gt 0 ]]; then
for unit in "${ENABLED[@]}"; do
unit=$(printf "$unit")
systemctl --user enable $unit
done
fi
if [[ ${#USER_DISABLED[@]} -gt 0 ]]; then
for unit in "${DISABLED[@]}"; do
unit=$(printf "$unit")
systemctl --user disable $unit
done
fi