feat(init): Adding more template files for init
This commit is contained in:
parent
c559fb4d6b
commit
556652f92a
10 changed files with 273 additions and 1 deletions
|
|
@ -2,7 +2,6 @@ FROM {{ base_image }}:{{ image_version }}
|
|||
|
||||
ARG RECIPE={{ recipe }}
|
||||
|
||||
|
||||
# Copy the bling from ublue-os/bling into tmp, to be installed later by the bling module
|
||||
# Feel free to remove these lines if you want to speed up image builds and don't want any bling
|
||||
COPY --from=ghcr.io/ublue-os/bling:latest /rpms /tmp/bling/rpms
|
||||
|
|
|
|||
2
templates/init/100-bling.just
Normal file
2
templates/init/100-bling.just
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# this file is a placeholder,
|
||||
# making changes here is not supported
|
||||
2
templates/init/60-custom.just
Normal file
2
templates/init/60-custom.just
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
!include 100-bling.just
|
||||
# Include some of your custom scripts here!
|
||||
9
templates/init/autostart.desktop
Normal file
9
templates/init/autostart.desktop
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[Desktop Entry]
|
||||
Name=uBlue First Boot Setup
|
||||
Comment=Sets up the uBlue desktop on first boot.
|
||||
GenericName=Launcher
|
||||
Categories=Utility;System;
|
||||
Exec=/usr/share/ublue-os/firstboot/launcher/autostart.sh
|
||||
Icon=application-x-executable
|
||||
Terminal=false
|
||||
Type=Application
|
||||
4
templates/init/autostart.sh
Normal file
4
templates/init/autostart.sh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Simply launches the "yafti" GUI with the uBlue image's configuration.
|
||||
/usr/bin/yafti /usr/share/ublue-os/firstboot/yafti.yml
|
||||
42
templates/init/config.README.md.tera
Normal file
42
templates/init/config.README.md.tera
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# Configuring your image
|
||||
|
||||
The main file of your is *the recipe file*. You can have multiple recipe files, and the ones to build are declared in the matrix section of [.gitlab-ci.yml](../.gitlab-ci.yml).
|
||||
|
||||
## Basic options
|
||||
|
||||
At the top of the recipe, there are four *mandatory* configuration options.
|
||||
|
||||
`name:` is the name of the image that is used when rebasing to it. For example, the name "sapphire" would result in the final URL of the container being `registry.gitlab.com/<yourusername>/sapphire`.
|
||||
|
||||
`description:` is a short description of your image that will be attached to your image's metadata.
|
||||
|
||||
`base-image:` is the URL of the image your image will be built upon.
|
||||
|
||||
`image-version:` is the version tag of the `base-image` that will be pulled. For example, Universal Blue's images build with Fedora version tags (`38`, `39`), with the `latest` tag for the latest major version, and [many other tags](https://github.com/ublue-os/main/pkgs/container/base-main/versions?filters%5Bversion_type%5D=tagged).
|
||||
|
||||
## Modules
|
||||
|
||||
The core of startingpoint's configuration is built around the idea of modules. Modules are scripts in the [`../modules`](../modules/) directory that you configure under `modules:` in the recipe. They are executed in order, and can run arbitrary shell commands and write any files.
|
||||
|
||||
This repository fetches some useful default modules from [`ublue-os/bling`](https://github.com/ublue-os/bling/), like [`rpm-ostree`](https://universal-blue.org/tinker/modules/rpm-ostree) for pseudo-declarative package management, [`bling`](https://universal-blue.org/tinker/modules/bling) for pulling extra components from [`ublue-os/bling`](https://github.com/ublue-os/bling), and [`files`](https://universal-blue.org/tinker/modules/files) for copying files from the `config/files/` directory into your image.
|
||||
|
||||
For a comprehensive list of modules, their in-depth documentation and example configuration, check out [the Modules page on the website](https://universal-blue.org/tinker/modules/).
|
||||
|
||||
### Building multiple images and including module configuration from other files and
|
||||
|
||||
To build multiple images, you need to create another recipe.yml file, which you should name based on what kind of image you want it to build. Then, edit the [.gitlab-ci.yml](../.gitlab-ci.yml) file. Inside the file, under `build-image: parallel: matrix:`, there's a list of recipe files to build images, which you need to add your new recipe file to. These should be paths to files inside the `config` directory.
|
||||
|
||||
Module configuration can be included from other files using the `from-file` syntax. The value should be a path to a file inside the `config` directory. For example, the following snippet could be used to include the configuration for installing a set of packages common to multiple images.
|
||||
```yaml
|
||||
modules:
|
||||
- from-file: common-packages.yml
|
||||
```
|
||||
And inside config/common-packages.yml
|
||||
```yaml
|
||||
type: rpm-ostree
|
||||
install:
|
||||
- i3
|
||||
- dunst
|
||||
- rofi
|
||||
- kitty
|
||||
```
|
||||
10
templates/init/example.sh
Normal file
10
templates/init/example.sh
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Tell this script to exit if there are any errors.
|
||||
# You should have this in every custom script, to ensure that your completed
|
||||
# builds actually ran successfully without any errors!
|
||||
set -oue pipefail
|
||||
|
||||
# Your code goes here.
|
||||
echo 'This is an example shell script'
|
||||
echo 'Scripts here will run during build if specified in recipe.yml'
|
||||
15
templates/init/login-profile.sh
Normal file
15
templates/init/login-profile.sh
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Only process users with home directories, but skip the "root" user.
|
||||
if [ "$(id -u)" != "0" ] && [ ! -z "$HOME" ] && [ -d "$HOME" ]; then
|
||||
# Ensure target file exists and is a symlink (not a regular file or dir).
|
||||
if [ ! -L "$HOME"/.config/autostart/ublue-firstboot.desktop ]; then
|
||||
# Remove any leftovers or incorrect (non-link) files with the same name.
|
||||
rm -rf "$HOME"/.config/autostart/ublue-firstboot.desktop
|
||||
|
||||
# Create symlink to uBlue's autostart runner.
|
||||
# Note that "broken autostart symlinks" are harmless if they remain
|
||||
# after distro switching, and just cause a minor syslog warning. The
|
||||
# user can manually delete this file if they migrate away from uBlue.
|
||||
mkdir -p "$HOME"/.config/autostart
|
||||
ln -s "/usr/share/ublue-os/firstboot/launcher/autostart.desktop" "$HOME"/.config/autostart/ublue-firstboot.desktop
|
||||
fi
|
||||
fi
|
||||
46
templates/init/modules.README.md.tera
Normal file
46
templates/init/modules.README.md.tera
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# Making modules
|
||||
|
||||
If you want to extend Startingpoint with custom functionality that requires configuration, you should create a module. Modules are scripts in the subdirectories of this directory. The `type:` key in the recipe.yml should be used as both the name of the folder and script, with the script having an additional `.sh` suffix. Creating a custom module with the same name as a default module will override it.
|
||||
|
||||
Each module intended for public usage should include a `README.md` file inside it's directory with a short description of the module and documentation for each configuration option.
|
||||
|
||||
Modules get only the configuration options given to them in the recipe.yml, not the configuration of other modules or any top-level keys. The configuration is given as the first argument as a single-line json string. You can check out the default modules for examples on how to parse such string using `yq` or `jq`.
|
||||
|
||||
Additionally, each module has access to four environment variables, `CONFIG_DIRECTORY` pointing to the Startingpoint directory in `/usr/share/ublue-os/`, `IMAGE_NAME` being the name of the image as declared in the recipe, `BASE_IMAGE` being the URL of the container image used as the base (FROM) in the image, and `OS_VERSION` being the `VERSION_ID` from `/usr/lib/os-release`.
|
||||
|
||||
When running modules, the working directory is the `CONFIG_DIRECTORY`.
|
||||
|
||||
A helper bash function called `get_yaml_array` is exported from the main build script.
|
||||
```bash
|
||||
# "$1" is the first cli argument, being the module configuration.
|
||||
# If you need to read from some other JSON string, just replace "$1" with "$VARNAME".
|
||||
get_yaml_array OUTPUT_VAR_NAME '.yq.key.to.array[]' "$1"
|
||||
for THING in "${OUTPUT_VAR_NAME[@]}"; do
|
||||
echo "$THING"
|
||||
done
|
||||
```
|
||||
|
||||
All bash-based modules should start with the following lines to ensure the image builds fail on errors, and that the correct shell is used to run them.
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
set -oue pipefail
|
||||
```
|
||||
|
||||
## Style directions for official modules
|
||||
|
||||
These are general directions for writing official modules and their documentation to follow to keep a consistent style. Not all of these are to be mindlessly followed, especially the ones about grammar and writing style. It's good to keep these in mind if you intend to contribute back upstream, though, so that your module doesn't feel out of place.
|
||||
|
||||
### Bash
|
||||
|
||||
- Start with `#!/usr/bin/env bash` and `set -oue pipefail`
|
||||
- Don't print "===", this is only for encapsulating the output of _different_ modules in `build.sh`
|
||||
- Print something on each step and on errors for easier debugging
|
||||
- Use CAPITALIZED names for variables that are read from the configuration
|
||||
|
||||
### README
|
||||
|
||||
- Title should be "`type` Module for Startingpoint", where the name/type of the module is a noun that shows the module's purpose
|
||||
- There should be a subtitle "Example configuration", under which there should be a loosely documented yaml block showcasing each of the module's configuration options
|
||||
- For a YAML block, specify the language as "yaml", not "yml" (MkDocs only supports "yaml")
|
||||
- At the start of each paragraph, refer to the module using its name or with "the module", not "it" or "the script"
|
||||
- Use passive grammar when talking about the user, ie. "should be used", "can be configured", preferring references to what the module does, ie. "This module downloads the answer to the question of life, the universe and everything..."
|
||||
143
templates/init/yafti.yml
Normal file
143
templates/init/yafti.yml
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
title: Welcome to uBlue
|
||||
properties:
|
||||
mode: "run-on-change"
|
||||
screens:
|
||||
first-screen:
|
||||
source: yafti.screen.title
|
||||
values:
|
||||
title: "Welcome to uBlue (Alpha)"
|
||||
icon: "/path/to/icon"
|
||||
description: |
|
||||
This guided installer will help you get started with your new system.
|
||||
can-we-modify-your-flatpaks:
|
||||
source: yafti.screen.consent
|
||||
values:
|
||||
title: Welcome, Traveler!
|
||||
condition:
|
||||
run: flatpak remotes --columns=name | grep fedora
|
||||
description: |
|
||||
We have detected the limited, Fedora-provided Flatpak remote on your system, whose applications are usually missing important codecs and other features. This step will therefore remove all basic Fedora Flatpaks from your system! We will instead switch all core Flatpak applications over to the vastly superior, unfiltered Flathub. If you don't want to do this, simply exit this installer.
|
||||
actions:
|
||||
- run: flatpak remote-delete --system --force fedora
|
||||
- run: flatpak remote-delete --user --force fedora
|
||||
- run: flatpak remove --system --noninteractive --all
|
||||
- run: flatpak remote-add --if-not-exists --system flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
- run: flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
check-system-flathub:
|
||||
source: yafti.screen.consent
|
||||
values:
|
||||
title: Missing Flathub Repository (System)
|
||||
condition:
|
||||
run: flatpak remotes --system --columns=name | grep flathub | wc -l | grep '^0$'
|
||||
description: |
|
||||
We have detected that you don't have Flathub's repository on your system. We will now add that repository to your system-wide list.
|
||||
actions:
|
||||
- run: flatpak remote-add --if-not-exists --system flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
check-user-flathub:
|
||||
source: yafti.screen.consent
|
||||
values:
|
||||
title: Missing Flathub Repository (User)
|
||||
condition:
|
||||
run: flatpak remotes --user --columns=name | grep flathub | wc -l | grep '^0$'
|
||||
description: |
|
||||
We have detected that you don't have Flathub's repository on your current user account. We will now add that repository to your account.
|
||||
actions:
|
||||
- run: flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
applications:
|
||||
source: yafti.screen.package
|
||||
values:
|
||||
title: Application Installer
|
||||
show_terminal: true
|
||||
package_manager: yafti.plugin.flatpak
|
||||
package_manager_defaults:
|
||||
user: false
|
||||
system: true
|
||||
groups:
|
||||
Core GNOME Apps:
|
||||
description: Core system applications for the GNOME desktop environment.
|
||||
default: true
|
||||
packages:
|
||||
- Calculator: org.gnome.Calculator
|
||||
- Calendar: org.gnome.Calendar
|
||||
- Camera: org.gnome.Snapshot
|
||||
- Characters: org.gnome.Characters
|
||||
- Clocks: org.gnome.clocks
|
||||
- Connections: org.gnome.Connections
|
||||
- Contacts: org.gnome.Contacts
|
||||
- Disk Usage Analyzer: org.gnome.baobab
|
||||
- Document Scanner: org.gnome.SimpleScan
|
||||
- Document Viewer: org.gnome.Evince
|
||||
- Extension Manager: com.mattjakeman.ExtensionManager
|
||||
- Font Viewer: org.gnome.font-viewer
|
||||
- Image Viewer: org.gnome.Loupe
|
||||
- Logs: org.gnome.Logs
|
||||
- Maps: org.gnome.Maps
|
||||
- Photos (Organizer): org.gnome.Photos
|
||||
- Sushi (Nautilus Previewer): org.gnome.NautilusPreviewer
|
||||
- Text Editor: org.gnome.TextEditor
|
||||
- Videos (Player): org.gnome.Totem
|
||||
- Weather: org.gnome.Weather
|
||||
System Apps:
|
||||
description: System applications for all desktop environments.
|
||||
default: true
|
||||
packages:
|
||||
- Deja Dup Backups: org.gnome.DejaDup
|
||||
- Fedora Media Writer: org.fedoraproject.MediaWriter
|
||||
- Flatseal (Permission Manager): com.github.tchx84.Flatseal
|
||||
- Font Downloader: org.gustavoperedo.FontDownloader
|
||||
- Mozilla Firefox: org.mozilla.firefox
|
||||
Web Browsers:
|
||||
description: Additional browsers to complement or replace Firefox.
|
||||
default: false
|
||||
packages:
|
||||
- Brave: com.brave.Browser
|
||||
- GNOME Web: org.gnome.Epiphany
|
||||
- Google Chrome: com.google.Chrome
|
||||
- Microsoft Edge: com.microsoft.Edge
|
||||
- Opera: com.opera.Opera
|
||||
Gaming:
|
||||
description: "Rock and Stone!"
|
||||
default: false
|
||||
packages:
|
||||
- Bottles: com.usebottles.bottles
|
||||
- Discord: com.discordapp.Discord
|
||||
- Heroic Games Launcher: com.heroicgameslauncher.hgl
|
||||
- Steam: com.valvesoftware.Steam
|
||||
- Gamescope (Utility): org.freedesktop.Platform.VulkanLayer.gamescope
|
||||
- MangoHUD (Utility): org.freedesktop.Platform.VulkanLayer.MangoHud//22.08
|
||||
- SteamTinkerLaunch (Utility): com.valvesoftware.Steam.Utility.steamtinkerlaunch
|
||||
- Proton Updater for Steam: net.davidotek.pupgui2
|
||||
Office:
|
||||
description: Boost your productivity.
|
||||
default: false
|
||||
packages:
|
||||
- LibreOffice: org.libreoffice.LibreOffice
|
||||
- OnlyOffice: org.onlyoffice.desktopeditors
|
||||
- Obsidian: md.obsidian.Obsidian
|
||||
- Slack: com.slack.Slack
|
||||
- Standard Notes: org.standardnotes.standardnotes
|
||||
- Thunderbird Email: org.mozilla.Thunderbird
|
||||
Streaming:
|
||||
description: Stream to the Internet.
|
||||
default: false
|
||||
packages:
|
||||
- OBS Studio: com.obsproject.Studio
|
||||
- VkCapture for OBS: com.obsproject.Studio.OBSVkCapture
|
||||
- Gstreamer for OBS: com.obsproject.Studio.Plugin.Gstreamer
|
||||
- Gstreamer VAAPI for OBS: com.obsproject.Studio.Plugin.GStreamerVaapi
|
||||
- Boatswain for Streamdeck: com.feaneron.Boatswain
|
||||
|
||||
final-screen:
|
||||
source: yafti.screen.title
|
||||
values:
|
||||
title: "All done!"
|
||||
icon: "/path/to/icon"
|
||||
links:
|
||||
- "Install More Applications":
|
||||
run: /usr/bin/gnome-software
|
||||
- "Website":
|
||||
run: /usr/bin/xdg-open https://ublue.it
|
||||
- "Join the Discord Community":
|
||||
run: /usr/bin/xdg-open https://discord.gg/XjG48C7VHx
|
||||
description: |
|
||||
Thanks for trying uBlue, we hope you enjoy it!
|
||||
Loading…
Add table
Add a link
Reference in a new issue