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
This commit is contained in:
parent
288945331e
commit
7c4dd1553e
21 changed files with 408 additions and 0 deletions
41
modules/systemd/README.md
Normal file
41
modules/systemd/README.md
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# `systemd` Module for Startingpoint
|
||||
|
||||
The `systemd` module streamlines the management of systemd units during image building. Units are divided into `system` and `user` categories, with `system` units managed directly using `systemctl` and `user` units using `systemctl --user`. You can specify which units to enable or disable under each category.
|
||||
|
||||
## Example Configuration:
|
||||
|
||||
```yaml
|
||||
type: systemd
|
||||
system:
|
||||
enable:
|
||||
- example.service
|
||||
disable:
|
||||
- example.target
|
||||
user:
|
||||
enable:
|
||||
- example.timer
|
||||
disable:
|
||||
- example.service
|
||||
```
|
||||
|
||||
In this example:
|
||||
|
||||
### System Units
|
||||
- `example.service`: Enabled (runs on system boot)
|
||||
- `example.target`: Disabled (does not run on system boot)
|
||||
|
||||
### User Units
|
||||
- `example.timer`: Enabled (runs for the user)
|
||||
- `example.service`: Disabled (does not run for the user)
|
||||
|
||||
This configuration achieves the same results as the following commands:
|
||||
|
||||
```sh
|
||||
# System Units
|
||||
systemctl enable example.service
|
||||
systemctl disable example.target
|
||||
|
||||
# User Units
|
||||
systemctl --user enable example.timer
|
||||
systemctl --user disable example.service
|
||||
```
|
||||
35
modules/systemd/systemd.sh
Normal file
35
modules/systemd/systemd.sh
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#!/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
|
||||
Loading…
Add table
Add a link
Reference in a new issue