Lots of cleanup

This commit is contained in:
Ryan Hughes committed 2025-08-28 19:44:01 +03:00
1 parent c5f7c41b3b
commit c57c9620de
15 files changed
+625 -1121

No files matched your search

+7 -16
View File
@@ -2,26 +2,17 @@ FROM archlinux:latest
# Update system and install build tools
RUN pacman -Syu --noconfirm && \
pacman -S --noconfirm base-devel git sudo wget jq
pacman -S --noconfirm base-devel git sudo wget jq gnupg
# Create build user
# Create build user (required for makepkg)
RUN useradd -m -G wheel builder && \
echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Create output directory
RUN mkdir -p /output && chown builder:builder /output
USER builder
WORKDIR /home/builder
WORKDIR /src
# Copy package list
COPY --chown=builder:builder packages ./
# Setup GPG directory
RUN mkdir -p ~/.gnupg && chmod 700 ~/.gnupg
# Copy build scripts
COPY --chown=builder:builder build-packages.sh ./
COPY --chown=builder:builder build-aur.sh ./
# Make scripts executable
RUN chmod +x build-packages.sh build-aur.sh
CMD ["./build-packages.sh"]
# Default command
CMD ["/build/build.sh"]
-141
View File
@@ -1,141 +0,0 @@
#!/bin/bash
# AUR package building functions
# Get version from local repo database
get_local_version() {
local pkg="$1"
if [[ -f /output/omarchy.db.tar.zst ]]; then
# First find the exact desc file for this package (not package-debug, etc)
# Pattern matches: package-version/desc where version starts with a number
local desc_file=$(tar -tf /output/omarchy.db.tar.zst | grep "^${pkg}-[0-9].*/desc$" | head -1)
if [[ -n "$desc_file" ]]; then
# Extract that specific file and get the version
tar -xOf /output/omarchy.db.tar.zst "$desc_file" 2>/dev/null |
awk '/%VERSION%/{getline; print; exit}'
fi
fi
}
# Simple function to build an AUR package
build_aur_package() {
local pkg="$1"
local opts="$2"
echo " -> Processing $pkg..."
# Get version from AUR API (also gets package base)
local aur_info=$(curl -s "https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=$pkg")
local aur_version=$(echo "$aur_info" | jq -r '.results[0].Version // empty')
local pkg_base=$(echo "$aur_info" | jq -r '.results[0].PackageBase // empty')
if [[ -z "$aur_version" ]]; then
echo " Package not found in AUR"
FAILED_PACKAGES="$FAILED_PACKAGES $pkg"
return 1
fi
# Use package name as base if not specified
if [[ -z "$pkg_base" ]]; then
pkg_base="$pkg"
elif [[ "$pkg_base" != "$pkg" ]]; then
echo " Using package base: $pkg_base"
fi
# Check if we need to build
local local_version=$(get_local_version "$pkg")
if [[ "$FORCE_REBUILD" == "true" ]]; then
echo " Forcing rebuild (AUR: $aur_version)"
elif [[ "$local_version" == "$aur_version" ]]; then
echo " Up to date: $local_version - Skipping build"
return 0
elif [[ -n "$local_version" ]]; then
echo " Update available: $local_version -> $aur_version"
else
echo " Not built yet (AUR: $aur_version)"
fi
# Always fresh clone when building
cd /src
rm -rf "$pkg"
git clone "https://aur.archlinux.org/${pkg_base}.git" "$pkg" || {
echo " Failed to clone $pkg_base"
FAILED_PACKAGES="$FAILED_PACKAGES $pkg"
return 1
}
cd "$pkg"
# Build package
MAKEPKG_FLAGS="-sc --noconfirm"
# Check for skip-pgp in options or global SKIP_PGP
if [[ "$SKIP_PGP" == "true" ]] || [[ "$opts" == *"skip-pgp"* ]]; then
MAKEPKG_FLAGS="$MAKEPKG_FLAGS --skippgpcheck"
echo " (skipping PGP verification)"
fi
if gpg --list-secret-keys 2>/dev/null | grep -q "sec"; then
makepkg $MAKEPKG_FLAGS --sign || {
echo " Failed to build $pkg"
FAILED_PACKAGES="$FAILED_PACKAGES $pkg"
cd /src
return 1
}
else
makepkg $MAKEPKG_FLAGS || {
echo " Failed to build $pkg"
FAILED_PACKAGES="$FAILED_PACKAGES $pkg"
cd /src
return 1
}
fi
# Copy to output and add to temporary build repo
for pkg_file in *.pkg.tar.*; do
if [[ -f "$pkg_file" ]] && [[ "$pkg_file" != *.sig ]]; then
cp "$pkg_file" /output/
# Add to temporary repo database (pointing to /output files)
repo-add /tmp/build-repo/omarchy-build.db.tar.gz "/output/$pkg_file"
fi
done
# Update pacman database to see new packages
sudo pacman -Sy
echo " Successfully built $pkg"
cd /src
}
build_aur_packages() {
# Work in the mounted src directory
cd /src
FAILED_PACKAGES=""
if [[ -s /tmp/packages.aur ]]; then
echo "==> Building AUR packages..."
while IFS= read -r line || [ -n "$line" ]; do
[[ "$line" =~ ^#.*$ ]] && continue
[[ -z "$line" ]] && continue
# Parse package name and options
package=$(echo "$line" | awk '{print $1}')
options=$(echo "$line" | awk '{$1=""; print $0}' | xargs)
# Build the package
build_aur_package "$package" "$options"
done </tmp/packages.aur
# Report failures at the end
if [[ -n "$FAILED_PACKAGES" ]]; then
echo ""
echo "==> Failed packages:"
for pkg in $FAILED_PACKAGES; do
echo " - $pkg"
done
fi
fi
}
-130
View File
@@ -1,130 +0,0 @@
#!/bin/bash
# Main build script that runs inside Docker container
# Don't use set -e so we can handle errors gracefully
# Import GPG keys
/build/import-gpg-keys.sh
# Sync pacman database
sudo pacman -Sy
echo "==> Processing package lists..."
FAILED_PACKAGES=""
PROCESSED_PACKAGES=""
# Merge and deduplicate all *.packages files from /build/packages
cat /build/packages/*.packages 2>/dev/null | \
grep -v '^#' | grep -v '^$' | \
awk '!seen[$1]++ {print}' > /tmp/packages.merged
# If ONLY_PACKAGES is set, filter the merged list
if [[ -n "$ONLY_PACKAGES" ]]; then
echo "==> Filtering packages: $ONLY_PACKAGES"
> /tmp/packages.filtered
for pkg in $ONLY_PACKAGES; do
grep "^$pkg\( \|$\)" /tmp/packages.merged >> /tmp/packages.filtered || echo " -> Warning: $pkg not found in package lists"
done
mv /tmp/packages.filtered /tmp/packages.merged
fi
# Separate packages into official and AUR
> /tmp/packages.official
> /tmp/packages.aur
while IFS= read -r line || [ -n "$line" ]; do
# Parse package name and options
package=$(echo "$line" | awk '{print $1}')
options=$(echo "$line" | awk '{$1=""; print $0}' | xargs)
# Check if it's in official repos
if pacman -Si "$package" &>/dev/null; then
echo "$package" >> /tmp/packages.official
else
echo "$line" >> /tmp/packages.aur # Keep options for AUR packages
fi
done < /tmp/packages.merged
# Show package counts
echo "==> Package breakdown:"
echo " -> Official packages: $(wc -l < /tmp/packages.official 2>/dev/null || echo 0)"
echo " -> AUR packages: $(wc -l < /tmp/packages.aur 2>/dev/null || echo 0)"
# Debug: Show AUR packages if any
if [[ -s /tmp/packages.aur ]]; then
echo "==> AUR packages to build:"
cat /tmp/packages.aur | while read line; do
echo " - $line"
done
fi
echo "==> Downloading official packages..."
OFFICIAL_FAILED=""
if [[ -s /tmp/packages.official ]]; then
while IFS= read -r package || [ -n "$package" ]; do
echo " -> Downloading $package..."
# Download package without installing (will use default cache which is now /output)
if ! sudo pacman -Sw --noconfirm "$package" 2>/dev/null; then
# Fallback to direct download
url=$(pacman -Sp "$package" 2>/dev/null)
if [[ -n "$url" ]]; then
if ! wget -q -P /output "$url"; then
echo " -> Failed to download $package"
OFFICIAL_FAILED="$OFFICIAL_FAILED $package"
fi
else
echo " -> Failed to download $package"
OFFICIAL_FAILED="$OFFICIAL_FAILED $package"
fi
fi
done < /tmp/packages.official
fi
# Source the AUR build functions
source /build/build-aur.sh
# Build AUR packages
build_aur_packages
echo ""
echo "==> Build Summary:"
# Count successes
TOTAL_OFFICIAL=$(wc -l < /tmp/packages.official 2>/dev/null || echo 0)
TOTAL_AUR=$(wc -l < /tmp/packages.aur 2>/dev/null || echo 0)
# Report official packages
if [[ -n "$OFFICIAL_FAILED" ]]; then
OFFICIAL_FAILED_COUNT=$(echo $OFFICIAL_FAILED | wc -w)
OFFICIAL_SUCCESS=$((TOTAL_OFFICIAL - OFFICIAL_FAILED_COUNT))
echo " Official packages: $OFFICIAL_SUCCESS/$TOTAL_OFFICIAL succeeded"
echo " Failed official packages:"
for pkg in $OFFICIAL_FAILED; do
echo " - $pkg"
done
else
echo " Official packages: $TOTAL_OFFICIAL/$TOTAL_OFFICIAL succeeded"
fi
# Report AUR packages (FAILED_PACKAGES comes from build-aur.sh)
if [[ -n "$FAILED_PACKAGES" ]]; then
AUR_FAILED_COUNT=$(echo $FAILED_PACKAGES | wc -w)
AUR_SUCCESS=$((TOTAL_AUR - AUR_FAILED_COUNT))
echo " AUR packages: $AUR_SUCCESS/$TOTAL_AUR succeeded"
echo " Failed AUR packages:"
for pkg in $FAILED_PACKAGES; do
echo " - $pkg"
done
else
echo " AUR packages: $TOTAL_AUR/$TOTAL_AUR succeeded"
fi
# Exit with error if any packages failed
if [[ -n "$OFFICIAL_FAILED" ]] || [[ -n "$FAILED_PACKAGES" ]]; then
echo ""
echo "==> Some packages failed to build/download"
exit 1
else
echo ""
echo "==> All packages processed successfully!"
fi
Executable
+176
View File
@@ -0,0 +1,176 @@
#!/bin/bash
# Simplified AUR-only build script that runs inside Docker container
# Import GPG keys
/build/import-gpg-keys.sh || exit 1
# Sync pacman database
sudo pacman -Sy
echo "==> AUR Package Builder"
echo "==> Processing omarchy-aur.packages"
# Track failures
FAILED_PACKAGES=""
SUCCESSFUL_PACKAGES=""
SKIPPED_PACKAGES=""
# Get version from local repo database
get_local_version() {
local pkg="$1"
if [[ -f /output/omarchy.db.tar.zst ]]; then
# Find the exact desc file for this package
local desc_file=$(tar -tf /output/omarchy.db.tar.zst | grep "^${pkg}-[0-9].*/desc$" | head -1)
if [[ -n "$desc_file" ]]; then
# Extract that specific file and get the version
tar -xOf /output/omarchy.db.tar.zst "$desc_file" 2>/dev/null |
awk '/%VERSION%/{getline; print; exit}'
fi
fi
}
# Build an AUR package
build_aur_package() {
local pkg="$1"
local opts="$2"
echo ""
echo " -> Processing $pkg..."
# Get version from AUR API (also gets package base)
local aur_info=$(curl -s "https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=$pkg")
local aur_version=$(echo "$aur_info" | jq -r '.results[0].Version // empty')
local pkg_base=$(echo "$aur_info" | jq -r '.results[0].PackageBase // empty')
if [[ -z "$aur_version" ]]; then
echo " ❌ Package not found in AUR"
FAILED_PACKAGES="$FAILED_PACKAGES $pkg"
return 1
fi
# Use package name as base if not specified
if [[ -z "$pkg_base" ]]; then
pkg_base="$pkg"
elif [[ "$pkg_base" != "$pkg" ]]; then
echo " Using package base: $pkg_base"
fi
# Check if we need to build
local local_version=$(get_local_version "$pkg")
if [[ "$local_version" == "$aur_version" ]]; then
echo " ✓ Up to date: $local_version - Skipping"
SKIPPED_PACKAGES="$SKIPPED_PACKAGES $pkg"
return 0
elif [[ -n "$local_version" ]]; then
echo " Update available: $local_version -> $aur_version"
else
echo " New package (AUR: $aur_version)"
fi
# Always fresh clone when building
cd /src
rm -rf "$pkg"
git clone "https://aur.archlinux.org/${pkg_base}.git" "$pkg" || {
echo " ❌ Failed to clone $pkg_base"
FAILED_PACKAGES="$FAILED_PACKAGES $pkg"
return 1
}
cd "$pkg"
# Build package with signing
MAKEPKG_FLAGS="-sc --noconfirm"
# Only add sign flag if we have a GPG key configured
if grep -q "^GPGKEY=" ~/.makepkg.conf 2>/dev/null; then
GPG_KEY=$(grep "^GPGKEY=" ~/.makepkg.conf | cut -d'"' -f2)
echo " Using GPG key: $GPG_KEY"
# We already tested signing in import-gpg-keys.sh, just add the flags
MAKEPKG_FLAGS="$MAKEPKG_FLAGS --sign --key $GPG_KEY"
else
echo " No GPG key configured in makepkg.conf"
fi
# Check for skip-pgp in options
if [[ "$opts" == *"skip-pgp"* ]]; then
MAKEPKG_FLAGS="$MAKEPKG_FLAGS --skippgpcheck"
echo " (skipping PGP verification)"
fi
if makepkg $MAKEPKG_FLAGS; then
# Copy to output (including signature files)
for pkg_file in *.pkg.tar.*; do
if [[ -f "$pkg_file" ]]; then
cp "$pkg_file" /output/
fi
done
echo " ✓ Successfully built $pkg"
SUCCESSFUL_PACKAGES="$SUCCESSFUL_PACKAGES $pkg"
else
echo " ❌ Failed to build $pkg"
FAILED_PACKAGES="$FAILED_PACKAGES $pkg"
cd /src
return 1
fi
cd /src
}
# Main execution
cd /src
# Read and process the AUR package file
if [[ -f /build/packages/omarchy-aur.packages ]]; then
TOTAL_COUNT=0
while IFS= read -r line || [ -n "$line" ]; do
[[ "$line" =~ ^#.*$ ]] && continue
[[ -z "$line" ]] && continue
((TOTAL_COUNT++))
# Parse package name and options
package=$(echo "$line" | awk '{print $1}')
options=$(echo "$line" | awk '{$1=""; print $0}' | xargs)
# Build the package
build_aur_package "$package" "$options"
done </build/packages/omarchy-aur.packages
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "==> Build Summary"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Count results
SUCCESS_COUNT=$(echo $SUCCESSFUL_PACKAGES | wc -w)
SKIPPED_COUNT=$(echo $SKIPPED_PACKAGES | wc -w)
FAILED_COUNT=$(echo $FAILED_PACKAGES | wc -w)
echo " Total packages: $TOTAL_COUNT"
echo " ✓ Built: $SUCCESS_COUNT"
echo " ⏭ Skipped: $SKIPPED_COUNT (already up-to-date)"
echo " ❌ Failed: $FAILED_COUNT"
# List failures if any
if [[ -n "$FAILED_PACKAGES" ]]; then
echo ""
echo "Failed packages:"
for pkg in $FAILED_PACKAGES; do
echo " - $pkg"
done
echo ""
echo "==> Some packages failed to build"
exit 1
else
echo ""
echo "==> All packages processed successfully!"
fi
else
echo "Error: /build/packages/omarchy-aur.packages not found"
exit 1
fi
+71
View File
@@ -0,0 +1,71 @@
#!/bin/bash
# Import GPG keys for package verification and signing
echo "==> Importing GPG keys..."
# Import signing key (required)
echo " -> Importing signing key..."
# Import with batch mode and no tty for automated signing
echo "$GPG_PRIVATE_KEY" | gpg --batch --import || {
echo " -> ERROR: Failed to import signing key"
exit 1
}
# Configure GPG for automated signing with passphrase
echo "allow-loopback-pinentry" >>~/.gnupg/gpg-agent.conf
echo "pinentry-mode loopback" >>~/.gnupg/gpg.conf
gpg-connect-agent reloadagent /bye 2>/dev/null || true
# Extract key ID and configure
KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep "sec" | head -1 | awk '{print $2}' | cut -d'/' -f2)
if [[ -n "$KEY_ID" ]]; then
# Trust the key using fingerprint
FINGERPRINT=$(gpg --list-secret-keys --with-colons | grep "^fpr" | head -1 | cut -d':' -f10)
echo "$FINGERPRINT:6:" | gpg --import-ownertrust
# Set as default key in makepkg.conf
echo "GPGKEY=\"$KEY_ID\"" >>~/.makepkg.conf
echo " -> Signing key configured: $KEY_ID"
# Test signing with the key and passphrase
echo " -> Testing GPG signing capability..."
echo "test" | gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" --sign --local-user "$KEY_ID" >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo " -> ERROR: Failed to sign with the provided passphrase"
echo " -> Please check your passphrase and try again"
exit 1
fi
echo " -> GPG signing test successful"
else
echo " -> ERROR: Could not extract key ID"
exit 1
fi
# Read the gpg-keys.txt file for verification keys
if [[ -f /build/gpg-keys.txt ]]; then
echo " -> Importing verification keys..."
while IFS= read -r line || [ -n "$line" ]; do
# Skip comments and empty lines
[[ "$line" =~ ^#.*$ ]] && continue
[[ -z "$line" ]] && continue
# Check if it's a URL (contains ://)
if [[ "$line" == *"://"* ]]; then
echo " - Importing key from $line"
curl -sS "$line" | gpg --import - || {
echo " Warning: Failed to import key from $line"
}
else
# It's a key ID - use receive-keys
echo " - Receiving key $line"
gpg --receive-keys "$line" || {
echo " Warning: Failed to receive key $line"
}
fi
done </build/gpg-keys.txt
echo " -> Verification key import complete"
else
echo " -> No gpg-keys.txt file found, skipping verification key import"
fi
echo " -> GPG setup complete"
-29
View File
@@ -1,29 +0,0 @@
nano
vim
openssh
htop
wireless_tools
wpa_supplicant
smartmontools
xdg-utils
dunst
kitty
dolphin
wofi
qt5-wayland
qt6-wayland
polkit-kde-agent
grim
xorg-server
xorg-xinit
mesa
xf86-video-amdgpu
xf86-video-ati
xf86-video-nouveau
libva-intel-driver
vulkan-radeon
vulkan-intel
vulkan-nouveau
sddm
efibootmgr
intel-media-driver
-165
View File
@@ -1,165 +0,0 @@
# Omarchy Repository Package List
# Format: packagename [options]
# Options: skip-pgp
# Lines starting with # are comments
# Empty lines are ignored
1password-beta skip-pgp
1password-cli skip-pgp
alacritty
autoconf-archive
avahi
base
base-devel
bash-completion
bat
blueberry
brightnessctl
btop
btrfs-progs
chromium
clang
cups
cups-browsed
cups-filters
cups-pdf
dart
docker
docker-buildx
docker-compose
dust
egl-wayland
evince
eza
fastfetch
fcitx5
fcitx5-gtk
fcitx5-qt
fd
ffmpegthumbnailer
fzf
gcc14
git
github-cli
gnome-calculator
gnome-keyring
gnome-themes-extra
grub
gst-plugin-pipewire
gtk4-layer-shell
gum
gvfs-mtp
htop
hypridle
hyprland
hyprland-qtutils
hyprlock
hyprpicker
hyprshot
hyprsunset
imagemagick
impala
imv
inetutils
intltool
iwd
jdk-openjdk
jq
kdenlive
kvantum-qt5
lazydocker
lazygit
less
libpulse
libqalculate
libreoffice-fresh
libsass
libva-nvidia-driver
limine-mkinitcpio-hook
limine-snapper-sync
linux
linux-firmware
linux-headers
llvm
localsend-bin
luarocks
mako
man-db
mariadb-libs
mise
mpv
nautilus
neovim
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
noto-fonts-extra
nss-mdns
nvidia-dkms
nvidia-open-dkms
nvidia-utils
obs-studio
obsidian
omarchy-chromium-bin
pamixer
pinta
pipewire
pipewire-alsa
pipewire-jack
pipewire-pulse
playerctl
plocate
plymouth
polkit-gnome
postgresql-libs
power-profiles-daemon
python-gobject
python-poetry-core
python-terminaltexteffects
qt5-remoteobjects
qt5-wayland
qt6-wayland
ripgrep
sassc
satty
signal-desktop
slurp
snapper
spotify
starship
sushi
swaybg
swayosd
system-config-printer
tldr
tree-sitter-cli
ttf-cascadia-mono-nerd
ttf-font-awesome
ttf-ia-writer
ttf-jetbrains-mono
typora
tzupdate
ufw
ufw-docker
unzip
uwsm
walker-bin
waybar
webp-pixbuf-loader
wf-recorder
wget
whois
wiremix
wireplumber
wl-clip-persist
wl-clipboard
wl-screenrec
woff2-font-awesome
xdg-desktop-portal-gtk
xdg-desktop-portal-hyprland
xmlstarlet
xournalpp
yaru-icon-theme
yay
zoxide
zram-generator