This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added systemd and files module (#142)
* feat: add files and systemd module * fix: yaml formatting * fix: yaml formatting * fix: remove comment completely * fix: yaml formatting * docs: add back inline comment * reformat: rename variables * fix: fix systemd escaped string * fix: fix systemd service formatting with printf * fix: attempting to fix systemd module problems * chore: remove debug config and code from systemd module * docs: added WIP docs for systemd, reworked files README * docs: added more detail for systemd module * docs: update READMEs to be more consistent * docs: remove unneeded sentence * docs: remove unneeded sentence * chore: fix issues described in PR review * docs: fix markdown formatting * docs: fix markdown formatting * docs: better markdown
- Loading branch information
Showing
18 changed files
with
164 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# `files` Module for Startingpoint | ||
|
||
The `files` module simplifies the process of copying files to the image during the build time. These files are sourced from the `config/files` directory, which is located at `/tmp/config/files` inside the image. | ||
|
||
> **Warning** | ||
> If you want to place anything in `/etc` of the final image, you MUST place them in `/usr/etc` in your repo, so that they're written to `/usr/etc` on the final system. That is the proper directory for "system" configuration templates on immutable Fedora distros, whereas the normal `/etc` is ONLY meant for manual overrides and editing by the machine's admin AFTER installation! See issue https://github.com/ublue-os/startingpoint/issues/28. | ||
## Example Configuration: | ||
|
||
```yaml | ||
type: files | ||
files: | ||
usr: /usr | ||
``` | ||
In the example above, `usr` represents the directory located inside the `config/files` in the repository, while `/usr` designates the corresponding destination within the image. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Tell build process to exit if there are any errors. | ||
set -oue pipefail | ||
|
||
get_yaml_array FILES '.files[]' "$1" | ||
|
||
cd "$CONFIG_DIRECTORY/files" | ||
|
||
if [[ ${#FILES[@]} -gt 0 ]]; then | ||
echo "Adding files to image" | ||
for pair in "${FILES[@]}"; do | ||
FILE="$PWD/$(echo $pair | yq 'to_entries | .[0].key')" | ||
DEST=$(echo $pair | yq 'to_entries | .[0].value') | ||
if [ -d "$FILE" ]; then | ||
if [ ! -d "$DEST" ]; then | ||
mkdir -p "$DEST" | ||
fi | ||
echo "Copying $FILE to $DEST" | ||
cp -r "$FILE"/* $DEST | ||
elif [ -f "$FILE" ]; then | ||
DEST_DIR=$(dirname "$DEST") | ||
if [ ! -d "$DEST_DIR" ]; then | ||
mkdir -p "$DEST_DIR" | ||
fi | ||
echo "Copying $FILE to $DEST" | ||
cp $FILE $DEST | ||
else | ||
echo "File or Directory $FILE Does Not Exist in $CONFIG_DIRECTORY/files" | ||
exit 1 | ||
fi | ||
done | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
# [`rpm-ostree`](https://coreos.github.io/rpm-ostree/) module for startingpoint | ||
# [`rpm-ostree`](https://coreos.github.io/rpm-ostree/) Module for Startingpoint | ||
|
||
The `rpm-ostree` module offers pseudo-declarative package and repository management using `rpm-ostree`. | ||
|
||
The module first downloads the repository files from repositories declared under `repos:` into `/etc/yum.repos.d/`. The magic string `%OS_VERSION%` is substituted with the current VERSION_ID (major Fedora version), which can be used, for example, for pulling correct versions of repositories from [Fedora's Copr](https://copr.fedorainfracloud.org/). | ||
|
||
Then the module installs the packages declared under `install:` using `rpm-ostree install`, and lastly, it removes the packages declared under `remove:` using `rpm-ostree override remove`. | ||
|
||
Unfortunately, currently `rpm-ostree override remove`, and this module, might not be able to remove packages installed in image builds. Packages included by Fedora, such as Firefox can still be removed, though. | ||
|
||
Additionally, the `rpm-ostree` module supports a temporary (waiting for `rpm-ostree` issue [#233](https://github.com/coreos/rpm-ostree/issues/233)) fix for packages that install into `/opt/`. Installation for packages that install into folder names declared under `optfix:` are fixed using some symlinks. | ||
|
||
Example configuration: | ||
|
||
## Example Configuration: | ||
|
||
```yml | ||
type: rpm-ostree | ||
repos: | ||
repos: | ||
- https://copr.fedorainfracloud.org/coprs/atim/starship/repo/fedora-%OS_VERSION%/atim-starship-fedora-%OS_VERSION%.repo | ||
install: | ||
- python3-pip | ||
- libadwaita | ||
remove: | ||
- firefox | ||
- firefox-langpacks | ||
``` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
# [`yafti`](https://github.com/ublue-os/yafti) module for startingpoint | ||
# [`yafti`](https://github.com/ublue-os/yafti) Module for Startingpoint | ||
|
||
If included, the `yafti` module will install `yafti` and set it up to run on first boot. | ||
|
||
Optionally, a list of Flatpak names and IDs can be included under `custom-flatpaks:`. These will be enabled by default under their own section on the Flatpak installation screen of `yafti`. | ||
|
||
The main `yafti` configuration file, `yafti.yml`, is in `/usr/share/ublue-os/firstboot/yafti.yml` and can be edited for a more custom first-boot experience. | ||
|
||
Example configuration: | ||
## Example configuration: | ||
|
||
```yml | ||
type: yafti | ||
custom-flatpaks: | ||
- Celluloid: io.github.celluloid_player.Celluloid | ||
- Krita: org.kde.krita | ||
``` | ||
``` |