Initial commit
This commit is contained in:
Executable
+65
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
set -eoux pipefail
|
||||
|
||||
###############################################################################
|
||||
# Main Build Script
|
||||
###############################################################################
|
||||
# This script follows the @ublue-os/bluefin pattern for build scripts.
|
||||
# It uses set -eoux pipefail for strict error handling and debugging.
|
||||
###############################################################################
|
||||
|
||||
# Source helper functions
|
||||
# shellcheck source=/dev/null
|
||||
source /ctx/build/copr-helpers.sh
|
||||
|
||||
# Enable nullglob for all glob operations to prevent failures on empty matches
|
||||
shopt -s nullglob
|
||||
|
||||
echo "::group:: Copy Bluefin Config from Common"
|
||||
|
||||
# Copy just files from @projectbluefin/common (includes 00-entry.just which imports 60-custom.just)
|
||||
mkdir -p /usr/share/ublue-os/just/
|
||||
shopt -s nullglob
|
||||
cp -r /ctx/oci/common/bluefin/usr/share/ublue-os/just/* /usr/share/ublue-os/just/
|
||||
shopt -u nullglob
|
||||
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group:: Copy Custom Files"
|
||||
|
||||
# Copy Brewfiles to standard location
|
||||
mkdir -p /usr/share/ublue-os/homebrew/
|
||||
cp /ctx/custom/brew/*.Brewfile /usr/share/ublue-os/homebrew/
|
||||
|
||||
# Consolidate Just Files
|
||||
find /ctx/custom/ujust -iname '*.just' -exec printf "\n\n" \; -exec cat {} \; >> /usr/share/ublue-os/just/60-custom.just
|
||||
|
||||
# Copy Flatpak preinstall files
|
||||
mkdir -p /etc/flatpak/preinstall.d/
|
||||
cp /ctx/custom/flatpaks/*.preinstall /etc/flatpak/preinstall.d/
|
||||
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group:: Install Packages"
|
||||
|
||||
# Install packages using dnf5
|
||||
# Example: dnf5 install -y tmux
|
||||
|
||||
# Example using COPR with isolated pattern:
|
||||
# copr_install_isolated "ublue-os/staging" package-name
|
||||
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group:: System Configuration"
|
||||
|
||||
# Enable/disable systemd services
|
||||
systemctl enable podman.socket
|
||||
# Example: systemctl mask unwanted-service
|
||||
|
||||
echo "::endgroup::"
|
||||
|
||||
# Restore default glob behavior
|
||||
shopt -u nullglob
|
||||
|
||||
echo "Custom build complete!"
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Tell build process to exit if there are any errors.
|
||||
set -oue pipefail
|
||||
|
||||
###############################################################################
|
||||
# Example: Installing 1Password and Google Chrome from Official Repositories
|
||||
###############################################################################
|
||||
# This is an EXAMPLE file showing how to add third-party RPM repositories
|
||||
# and install packages from them following Universal Blue/Bluefin conventions.
|
||||
#
|
||||
# To use this script:
|
||||
# 1. Rename this file to remove the .example extension: 20-onepassword.sh
|
||||
# 2. The build system will automatically run scripts in numerical order
|
||||
#
|
||||
# IMPORTANT CONVENTIONS (from @ublue-os/bluefin):
|
||||
# - Always clean up temporary repository files after installation
|
||||
# - Use dnf5 exclusively (never dnf or yum)
|
||||
# - Always use -y flag for non-interactive operations
|
||||
# - Remove repo files to keep the image clean (repos don't work at runtime)
|
||||
###############################################################################
|
||||
|
||||
### Install Google Chrome from Official Repository
|
||||
echo "Installing Google Chrome..."
|
||||
|
||||
# Add Google Chrome RPM repository
|
||||
cat > /etc/yum.repos.d/google-chrome.repo << 'EOF'
|
||||
[google-chrome]
|
||||
name=google-chrome
|
||||
baseurl=https://dl.google.com/linux/chrome/rpm/stable/x86_64
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
gpgkey=https://dl.google.com/linux/linux_signing_key.pub
|
||||
EOF
|
||||
|
||||
# Install Chrome
|
||||
dnf5 install -y google-chrome-stable
|
||||
|
||||
# Clean up repo file (required - repos don't work at runtime in bootc images)
|
||||
rm -f /etc/yum.repos.d/google-chrome.repo
|
||||
|
||||
echo "Google Chrome installed successfully"
|
||||
|
||||
### Install 1Password from Official Repository
|
||||
echo "Installing 1Password..."
|
||||
|
||||
# Add 1Password RPM repository GPG key
|
||||
rpm --import https://downloads.1password.com/linux/keys/1password.asc
|
||||
|
||||
# Add 1Password RPM repository
|
||||
cat > /etc/yum.repos.d/1password.repo << 'EOF'
|
||||
[1password]
|
||||
name=1Password Stable Channel
|
||||
baseurl=https://downloads.1password.com/linux/rpm/stable/$basearch
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
repo_gpgcheck=1
|
||||
gpgkey=https://downloads.1password.com/linux/keys/1password.asc
|
||||
EOF
|
||||
|
||||
# Install 1Password
|
||||
dnf5 install -y 1password
|
||||
|
||||
# Clean up repo file (required - repos don't work at runtime in bootc images)
|
||||
rm -f /etc/yum.repos.d/1password.repo
|
||||
|
||||
echo "1Password installed successfully"
|
||||
echo "Chrome and 1Password installation complete!"
|
||||
Executable
+92
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
set -eoux pipefail
|
||||
|
||||
###############################################################################
|
||||
# Example: Swap GNOME Desktop with COSMIC Desktop
|
||||
###############################################################################
|
||||
# This example demonstrates replacing the GNOME desktop environment with
|
||||
# System76's COSMIC desktop from their COPR repository.
|
||||
#
|
||||
# COSMIC is a new desktop environment built in Rust by System76.
|
||||
# https://github.com/pop-os/cosmic-epoch
|
||||
#
|
||||
# To use this script:
|
||||
# 1. Rename to remove .example extension: mv 30-cosmic-desktop.sh.example 30-cosmic-desktop.sh
|
||||
# 2. Build - scripts run in numerical order automatically
|
||||
#
|
||||
# WARNING: This removes GNOME and replaces it with COSMIC. Only use this if
|
||||
# you want COSMIC as your desktop environment instead of GNOME.
|
||||
###############################################################################
|
||||
|
||||
# Source helper functions
|
||||
# shellcheck source=/dev/null
|
||||
source /ctx/build/copr-helpers.sh
|
||||
|
||||
echo "::group:: Remove GNOME Desktop"
|
||||
|
||||
# Remove GNOME Shell and related packages
|
||||
dnf5 remove -y \
|
||||
gnome-shell \
|
||||
gnome-shell-extension* \
|
||||
gnome-terminal \
|
||||
gnome-software \
|
||||
gnome-control-center \
|
||||
nautilus \
|
||||
gdm
|
||||
|
||||
echo "GNOME desktop removed"
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group:: Install COSMIC Desktop"
|
||||
|
||||
# Install COSMIC desktop from System76's COPR
|
||||
# Using isolated pattern to prevent COPR from persisting
|
||||
copr_install_isolated "ryanabx/cosmic-epoch" \
|
||||
cosmic-session \
|
||||
cosmic-greeter \
|
||||
cosmic-comp \
|
||||
cosmic-panel \
|
||||
cosmic-launcher \
|
||||
cosmic-applets \
|
||||
cosmic-settings \
|
||||
cosmic-files \
|
||||
cosmic-edit \
|
||||
cosmic-term \
|
||||
cosmic-workspaces
|
||||
|
||||
echo "COSMIC desktop installed successfully"
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group:: Configure Display Manager"
|
||||
|
||||
# Enable cosmic-greeter (COSMIC's display manager)
|
||||
systemctl enable cosmic-greeter
|
||||
|
||||
# Set COSMIC as default session
|
||||
mkdir -p /etc/X11/sessions
|
||||
cat > /etc/X11/sessions/cosmic.desktop << 'COSMICDESKTOP'
|
||||
[Desktop Entry]
|
||||
Name=COSMIC
|
||||
Comment=COSMIC Desktop Environment
|
||||
Exec=cosmic-session
|
||||
Type=Application
|
||||
DesktopNames=COSMIC
|
||||
COSMICDESKTOP
|
||||
|
||||
echo "Display manager configured"
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group:: Install Additional Utilities"
|
||||
|
||||
# Install additional utilities that work well with COSMIC
|
||||
dnf5 install -y \
|
||||
kitty \
|
||||
flatpak \
|
||||
xdg-desktop-portal-cosmic
|
||||
|
||||
echo "Additional utilities installed"
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "COSMIC desktop installation complete!"
|
||||
echo "After booting, select 'COSMIC' session at the login screen"
|
||||
@@ -0,0 +1,77 @@
|
||||
# Build Scripts
|
||||
|
||||
This directory contains build scripts that run during image creation. Scripts are executed in numerical order.
|
||||
|
||||
## How It Works
|
||||
|
||||
Scripts are named with a number prefix (e.g., `10-build.sh`, `20-onepassword.sh`) and run in ascending order during the container build process.
|
||||
|
||||
## Included Scripts
|
||||
|
||||
- **`10-build.sh`** - Main build script for base system modifications, package installation, and service configuration
|
||||
|
||||
## Example Scripts
|
||||
|
||||
- **`20-onepassword.sh.example`** - Example showing how to install software from third-party RPM repositories (Google Chrome, 1Password)
|
||||
|
||||
To use an example script:
|
||||
1. Remove the `.example` extension
|
||||
2. Make it executable: `chmod +x build/20-yourscript.sh`
|
||||
3. The build system will automatically run it in numerical order
|
||||
|
||||
## Creating Your Own Scripts
|
||||
|
||||
Create numbered scripts for different purposes:
|
||||
|
||||
```bash
|
||||
# 10-build.sh - Base system (already exists)
|
||||
# 20-drivers.sh - Hardware drivers
|
||||
# 30-development.sh - Development tools
|
||||
# 40-gaming.sh - Gaming software
|
||||
# 50-cleanup.sh - Final cleanup tasks
|
||||
```
|
||||
|
||||
### Script Template
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
set -oue pipefail
|
||||
|
||||
echo "Running custom setup..."
|
||||
# Your commands here
|
||||
```
|
||||
|
||||
### Best Practices
|
||||
|
||||
- **Use descriptive names**: `20-nvidia-drivers.sh` is better than `20-stuff.sh`
|
||||
- **One purpose per script**: Easier to debug and maintain
|
||||
- **Clean up after yourself**: Remove temporary files and disable temporary repos
|
||||
- **Test incrementally**: Add one script at a time and test builds
|
||||
- **Comment your code**: Future you will thank present you
|
||||
|
||||
### Disabling Scripts
|
||||
|
||||
To temporarily disable a script without deleting it:
|
||||
- Rename it with `.disabled` extension: `20-script.sh.disabled`
|
||||
- Or remove execute permission: `chmod -x build/20-script.sh`
|
||||
|
||||
## Execution Order
|
||||
|
||||
The Containerfile runs scripts like this:
|
||||
|
||||
```dockerfile
|
||||
RUN /ctx/build/10-build.sh
|
||||
```
|
||||
|
||||
If you want to run multiple scripts, you can:
|
||||
|
||||
1. **Modify Containerfile** to run each script explicitly
|
||||
2. **Create a runner script** that executes all numbered scripts
|
||||
3. **Use the default** and keep everything in `10-build.sh` (simplest)
|
||||
|
||||
## Notes
|
||||
|
||||
- Scripts run as root during build
|
||||
- Build context is available at `/ctx`
|
||||
- Use dnf5 for package management (not dnf or yum)
|
||||
- Always use `-y` flag for non-interactive installs
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
###############################################################################
|
||||
# COPR Helper Functions
|
||||
###############################################################################
|
||||
# These helper functions follow the @ublue-os/bluefin pattern for managing
|
||||
# COPR repositories in a safe, isolated manner.
|
||||
###############################################################################
|
||||
|
||||
copr_install_isolated() {
|
||||
local copr_name="$1"
|
||||
shift
|
||||
local packages=("$@")
|
||||
|
||||
if [[ ${#packages[@]} -eq 0 ]]; then
|
||||
echo "ERROR: No packages specified for copr_install_isolated"
|
||||
return 1
|
||||
fi
|
||||
|
||||
repo_id="copr:copr.fedorainfracloud.org:${copr_name//\//:}"
|
||||
|
||||
echo "Installing ${packages[*]} from COPR $copr_name (isolated)"
|
||||
|
||||
dnf5 -y copr enable "$copr_name"
|
||||
dnf5 -y copr disable "$copr_name"
|
||||
dnf5 -y install --enablerepo="$repo_id" "${packages[@]}"
|
||||
|
||||
echo "Installed ${packages[*]} from $copr_name"
|
||||
}
|
||||
Reference in New Issue
Block a user