Lots of cleanup
This commit is contained in:
@@ -1,244 +0,0 @@
|
||||
# Omarchy Repository
|
||||
|
||||
A custom Arch Linux repository for managing and distributing packages.
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
omarchy-repo/
|
||||
├── x86_64/ # Repository packages and database
|
||||
├── src/ # AUR package build sources
|
||||
├── build/ # Docker build files
|
||||
├── bin/ # Management scripts
|
||||
└── packages # Package list
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. **Add packages to track:**
|
||||
- Edit `packages` file (system auto-detects if official or AUR)
|
||||
|
||||
2. **Build packages in Docker:**
|
||||
```bash
|
||||
./bin/build
|
||||
```
|
||||
|
||||
3. **Update repository database:**
|
||||
```bash
|
||||
./bin/update-repo
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Local Usage
|
||||
|
||||
Add this to `/etc/pacman.conf` (before other repositories for priority):
|
||||
|
||||
```ini
|
||||
[omarchy]
|
||||
SigLevel = Optional TrustAll
|
||||
Server = file:///home/ryan/Dev/omarchy-repo/x86_64
|
||||
```
|
||||
|
||||
### Remote Server Setup
|
||||
|
||||
To serve this repository over HTTP:
|
||||
|
||||
1. **Using Python (temporary):**
|
||||
```bash
|
||||
cd /home/ryan/Dev/omarchy-repo/x86_64
|
||||
python -m http.server 8080
|
||||
```
|
||||
|
||||
2. **Using nginx (permanent):**
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name repo.yourdomain.com;
|
||||
root /home/ryan/Dev/omarchy-repo/x86_64;
|
||||
autoindex on;
|
||||
}
|
||||
```
|
||||
|
||||
3. **Client configuration:**
|
||||
```ini
|
||||
[omarchy]
|
||||
SigLevel = Optional TrustAll
|
||||
Server = http://repo.yourdomain.com
|
||||
```
|
||||
|
||||
## Scripts Usage
|
||||
|
||||
### build
|
||||
|
||||
Builds all packages in Docker container (no local installation).
|
||||
|
||||
```bash
|
||||
# Build everything
|
||||
./bin/build
|
||||
|
||||
# Options:
|
||||
./bin/build --only "yay walker-bin" # Build specific packages
|
||||
./bin/build --skip-pgp # Skip PGP signature verification
|
||||
./bin/build --force # Force rebuild even if no updates
|
||||
./bin/build --keep-image # Keep Docker image after build
|
||||
```
|
||||
|
||||
### update-repo
|
||||
|
||||
Updates the repository database with all packages in x86_64/.
|
||||
|
||||
```bash
|
||||
# Update database
|
||||
./bin/update-repo
|
||||
|
||||
# Options:
|
||||
./bin/update-repo --verify # Only verify the database
|
||||
./bin/update-repo --sign # Sign database with GPG
|
||||
./bin/update-repo --stats # Show repository statistics
|
||||
```
|
||||
|
||||
### clean-repo
|
||||
|
||||
Maintains the repository by removing old packages.
|
||||
|
||||
```bash
|
||||
# Keep only latest 2 versions
|
||||
./bin/clean-repo
|
||||
|
||||
# Options:
|
||||
./bin/clean-repo --keep 3 # Keep 3 versions
|
||||
./bin/clean-repo --dry-run # Preview what would be removed
|
||||
./bin/clean-repo --all # Remove all packages (dangerous!)
|
||||
```
|
||||
|
||||
### sync-repo
|
||||
|
||||
Syncs repository to remote server.
|
||||
|
||||
```bash
|
||||
# Sync to configured remote
|
||||
./bin/sync-repo ./x86_64
|
||||
```
|
||||
|
||||
## ISO Integration
|
||||
|
||||
To include this repository in an Arch ISO:
|
||||
|
||||
1. Copy the entire `x86_64/` directory to the ISO
|
||||
2. Add the repository configuration to the ISO's `pacman.conf`
|
||||
3. The packages will be available during installation
|
||||
|
||||
## Package Management
|
||||
|
||||
### Adding Packages
|
||||
|
||||
1. Add package name to `packages.official` or `packages.aur`
|
||||
2. Run `./scripts/build-packages.sh`
|
||||
3. Run `./scripts/update-repo.sh`
|
||||
|
||||
### Removing Packages
|
||||
|
||||
1. Remove package name from the list files
|
||||
2. Delete the package file from `x86_64/`
|
||||
3. Run `./scripts/update-repo.sh`
|
||||
|
||||
### Updating Packages
|
||||
|
||||
Simply run the build script again - it will download/build the latest versions:
|
||||
|
||||
```bash
|
||||
./scripts/build-packages.sh
|
||||
./scripts/update-repo.sh
|
||||
```
|
||||
|
||||
## Security
|
||||
|
||||
### Package Signing (Optional)
|
||||
|
||||
1. **Create a GPG key:**
|
||||
```bash
|
||||
gpg --gen-key
|
||||
```
|
||||
|
||||
2. **Export public key:**
|
||||
```bash
|
||||
gpg --export --armor "Your Name" > omarchy-repo.key
|
||||
```
|
||||
|
||||
3. **Sign packages during build:**
|
||||
```bash
|
||||
./scripts/update-repo.sh --sign
|
||||
```
|
||||
|
||||
4. **Client configuration:**
|
||||
```ini
|
||||
[omarchy]
|
||||
SigLevel = Required
|
||||
Server = file:///home/ryan/Dev/omarchy-repo/x86_64
|
||||
```
|
||||
|
||||
## Maintenance
|
||||
|
||||
### Regular Updates
|
||||
|
||||
Create a systemd timer or cron job for automatic updates:
|
||||
|
||||
```bash
|
||||
# /etc/cron.daily/omarchy-repo-update
|
||||
#!/bin/bash
|
||||
cd /home/ryan/Dev/omarchy-repo
|
||||
./scripts/build-packages.sh
|
||||
./scripts/update-repo.sh
|
||||
./scripts/clean-repo.sh --keep 2
|
||||
```
|
||||
|
||||
### Backup
|
||||
|
||||
Important files to backup:
|
||||
- `packages.official`
|
||||
- `packages.aur`
|
||||
- `x86_64/*.pkg.tar.*`
|
||||
- GPG keys (if using signing)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
1. **"No packages found"**
|
||||
- Run `./scripts/build-packages.sh` first
|
||||
|
||||
2. **AUR build failures**
|
||||
- Check build dependencies
|
||||
- Try manual mode: `./scripts/build-packages.sh --manual`
|
||||
|
||||
3. **Repository not recognized by pacman**
|
||||
- Ensure the repository is listed before other repos in `/etc/pacman.conf`
|
||||
- Run `sudo pacman -Sy` to sync databases
|
||||
|
||||
4. **Permission errors**
|
||||
- Some operations need sudo (downloading official packages)
|
||||
- Ensure scripts are executable: `chmod +x scripts/*.sh`
|
||||
|
||||
## Advanced Usage
|
||||
|
||||
### Mirror Synchronization
|
||||
|
||||
To sync with another omarchy instance:
|
||||
|
||||
```bash
|
||||
rsync -av --delete \
|
||||
user@remote:/path/to/omarchy-repo/x86_64/ \
|
||||
/home/ryan/Dev/omarchy-repo/x86_64/
|
||||
```
|
||||
|
||||
### Custom Build Flags
|
||||
|
||||
For AUR packages, edit `/etc/makepkg.conf` to customize:
|
||||
- `CFLAGS` / `CXXFLAGS` for optimization
|
||||
- `MAKEFLAGS` for parallel compilation
|
||||
- `PACKAGER` for package attribution
|
||||
|
||||
## License
|
||||
|
||||
This repository structure and scripts are provided as-is for personal use.
|
||||
@@ -5,7 +5,7 @@ set -e
|
||||
|
||||
# Source common functions
|
||||
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
|
||||
source "$BUILD_ROOT/lib/common.sh"
|
||||
source "$BUILD_ROOT/lib/message-helpers.sh"
|
||||
|
||||
# Prepare build directories
|
||||
ARCH_DIR="$BUILD_ROOT/x86_64"
|
||||
|
||||
+202
-214
@@ -4,242 +4,230 @@
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
# Source common functions
|
||||
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
|
||||
source "$BUILD_ROOT/lib/message-helpers.sh"
|
||||
|
||||
# Repository configuration
|
||||
REPO_DIR="/home/ryan/Dev/omarchy-repo"
|
||||
ARCH_DIR="$REPO_DIR/x86_64"
|
||||
ARCH_DIR="$BUILD_ROOT/x86_64"
|
||||
KEEP_VERSIONS=2
|
||||
|
||||
# Function to print colored messages
|
||||
print_msg() {
|
||||
local color=$1
|
||||
local msg=$2
|
||||
echo -e "${color}${msg}${NC}"
|
||||
}
|
||||
|
||||
# Function to clean old packages
|
||||
clean_packages() {
|
||||
local keep=$1
|
||||
local dry_run=$2
|
||||
|
||||
print_msg "$BLUE" "==> Cleaning old packages (keeping $keep versions)..."
|
||||
|
||||
cd "$ARCH_DIR"
|
||||
|
||||
# Group packages by name
|
||||
declare -A packages
|
||||
|
||||
for pkg in *.pkg.tar.*; do
|
||||
[[ -f "$pkg" ]] || continue
|
||||
|
||||
# Skip signature files
|
||||
[[ "$pkg" == *.sig ]] && continue
|
||||
|
||||
# Extract package name (remove version and architecture)
|
||||
# Format: name-version-release-arch.pkg.tar.*
|
||||
local pkgname=$(echo "$pkg" | sed -E 's/-[0-9]+.*-(any|x86_64|i686)\.pkg\.tar\..*//')
|
||||
|
||||
# Add to array
|
||||
if [[ -n "${packages[$pkgname]}" ]]; then
|
||||
packages[$pkgname]="${packages[$pkgname]} $pkg"
|
||||
else
|
||||
packages[$pkgname]="$pkg"
|
||||
fi
|
||||
done
|
||||
|
||||
# Process each package group
|
||||
local total_removed=0
|
||||
local space_freed=0
|
||||
|
||||
for pkgname in "${!packages[@]}"; do
|
||||
# Convert string to array and sort by modification time (newest first)
|
||||
IFS=' ' read -ra pkg_files <<< "${packages[$pkgname]}"
|
||||
|
||||
# Sort by modification time
|
||||
local sorted_files=($(ls -t "${pkg_files[@]}" 2>/dev/null))
|
||||
local count=${#sorted_files[@]}
|
||||
|
||||
if [[ $count -gt $keep ]]; then
|
||||
print_msg "$GREEN" " -> Processing $pkgname ($count versions found)"
|
||||
|
||||
# Remove old versions
|
||||
for ((i=$keep; i<$count; i++)); do
|
||||
local file="${sorted_files[$i]}"
|
||||
local size=$(stat -c%s "$file" 2>/dev/null || echo 0)
|
||||
space_freed=$((space_freed + size))
|
||||
|
||||
if [[ "$dry_run" == true ]]; then
|
||||
print_msg "$YELLOW" " Would remove: $file ($(numfmt --to=iec-i --suffix=B $size))"
|
||||
else
|
||||
print_msg "$RED" " Removing: $file ($(numfmt --to=iec-i --suffix=B $size))"
|
||||
rm -f "$file"
|
||||
rm -f "${file}.sig" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
total_removed=$((total_removed + 1))
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
# Summary
|
||||
if [[ $total_removed -gt 0 ]]; then
|
||||
if [[ "$dry_run" == true ]]; then
|
||||
print_msg "$BLUE" "\n -> Would remove $total_removed old package(s)"
|
||||
print_msg "$BLUE" " -> Would free $(numfmt --to=iec-i --suffix=B $space_freed)"
|
||||
else
|
||||
print_msg "$GREEN" "\n -> Removed $total_removed old package(s)"
|
||||
print_msg "$GREEN" " -> Freed $(numfmt --to=iec-i --suffix=B $space_freed)"
|
||||
fi
|
||||
local keep=$1
|
||||
local dry_run=$2
|
||||
|
||||
print_info "Cleaning old packages (keeping $keep versions)..."
|
||||
|
||||
cd "$ARCH_DIR"
|
||||
|
||||
# Group packages by name
|
||||
declare -A packages
|
||||
|
||||
for pkg in *.pkg.tar.*; do
|
||||
[[ -f "$pkg" ]] || continue
|
||||
|
||||
# Skip signature files
|
||||
[[ "$pkg" == *.sig ]] && continue
|
||||
|
||||
# Extract package name (remove version and architecture)
|
||||
# Format: name-version-release-arch.pkg.tar.*
|
||||
local pkgname=$(echo "$pkg" | sed -E 's/-[0-9]+.*-(any|x86_64|i686)\.pkg\.tar\..*//')
|
||||
|
||||
# Add to array
|
||||
if [[ -n "${packages[$pkgname]}" ]]; then
|
||||
packages[$pkgname]="${packages[$pkgname]} $pkg"
|
||||
else
|
||||
print_msg "$YELLOW" " -> No old packages to remove"
|
||||
packages[$pkgname]="$pkg"
|
||||
fi
|
||||
done
|
||||
|
||||
# Process each package group
|
||||
local total_removed=0
|
||||
local space_freed=0
|
||||
|
||||
for pkgname in "${!packages[@]}"; do
|
||||
# Convert string to array and sort by modification time (newest first)
|
||||
IFS=' ' read -ra pkg_files <<<"${packages[$pkgname]}"
|
||||
|
||||
# Sort by modification time
|
||||
local sorted_files=($(ls -t "${pkg_files[@]}" 2>/dev/null))
|
||||
local count=${#sorted_files[@]}
|
||||
|
||||
if [[ $count -gt $keep ]]; then
|
||||
print_success " -> Processing $pkgname ($count versions found)"
|
||||
|
||||
# Remove old versions
|
||||
for ((i = $keep; i < $count; i++)); do
|
||||
local file="${sorted_files[$i]}"
|
||||
local size=$(stat -c%s "$file" 2>/dev/null || echo 0)
|
||||
space_freed=$((space_freed + size))
|
||||
|
||||
if [[ "$dry_run" == true ]]; then
|
||||
print_warning " Would remove: $file ($(numfmt --to=iec-i --suffix=B $size))"
|
||||
else
|
||||
print_error " Removing: $file ($(numfmt --to=iec-i --suffix=B $size))"
|
||||
rm -f "$file"
|
||||
rm -f "${file}.sig" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
total_removed=$((total_removed + 1))
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
# Summary
|
||||
if [[ $total_removed -gt 0 ]]; then
|
||||
if [[ "$dry_run" == true ]]; then
|
||||
print_info " -> Would remove $total_removed old package(s)"
|
||||
print_info " -> Would free $(numfmt --to=iec-i --suffix=B $space_freed)"
|
||||
else
|
||||
print_success " -> Removed $total_removed old package(s)"
|
||||
print_success " -> Freed $(numfmt --to=iec-i --suffix=B $space_freed)"
|
||||
fi
|
||||
else
|
||||
print_warning " -> No old packages to remove"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to remove all packages
|
||||
remove_all_packages() {
|
||||
local dry_run=$1
|
||||
|
||||
print_msg "$RED" "==> WARNING: Removing ALL packages from repository!"
|
||||
|
||||
if [[ "$dry_run" != true ]]; then
|
||||
read -p "Are you sure? Type 'yes' to confirm: " confirm
|
||||
if [[ "$confirm" != "yes" ]]; then
|
||||
print_msg "$YELLOW" "Cancelled."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
cd "$ARCH_DIR"
|
||||
|
||||
local count=$(ls -1 *.pkg.tar.* 2>/dev/null | wc -l)
|
||||
|
||||
if [[ $count -eq 0 ]]; then
|
||||
print_msg "$YELLOW" "No packages found to remove"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "$dry_run" == true ]]; then
|
||||
print_msg "$YELLOW" "Would remove $count package(s):"
|
||||
ls -1 *.pkg.tar.* 2>/dev/null | while read -r pkg; do
|
||||
echo " - $pkg"
|
||||
done
|
||||
else
|
||||
rm -f *.pkg.tar.*
|
||||
rm -f *.db* *.files*
|
||||
print_msg "$GREEN" "Removed $count package(s) and database files"
|
||||
local dry_run=$1
|
||||
|
||||
print_error "WARNING: Removing ALL packages from repository!"
|
||||
|
||||
if [[ "$dry_run" != true ]]; then
|
||||
read -p "Are you sure? Type 'yes' to confirm: " confirm
|
||||
if [[ "$confirm" != "yes" ]]; then
|
||||
print_warning "Cancelled."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
cd "$ARCH_DIR"
|
||||
|
||||
local count=$(ls -1 *.pkg.tar.* 2>/dev/null | wc -l)
|
||||
|
||||
if [[ $count -eq 0 ]]; then
|
||||
print_warning "No packages found to remove"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "$dry_run" == true ]]; then
|
||||
print_warning "Would remove $count package(s):"
|
||||
ls -1 *.pkg.tar.* 2>/dev/null | while read -r pkg; do
|
||||
echo " - $pkg"
|
||||
done
|
||||
else
|
||||
rm -f *.pkg.tar.*
|
||||
rm -f *.db* *.files*
|
||||
print_success "Removed $count package(s) and database files"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to show repository disk usage
|
||||
show_disk_usage() {
|
||||
print_msg "$BLUE" "\n==> Repository Disk Usage:"
|
||||
|
||||
cd "$ARCH_DIR"
|
||||
|
||||
local total_size=$(du -sh . 2>/dev/null | cut -f1)
|
||||
local package_count=$(ls -1 *.pkg.tar.* 2>/dev/null | grep -v '\.sig$' | wc -l)
|
||||
|
||||
print_msg "$GREEN" " -> Total size: $total_size"
|
||||
print_msg "$GREEN" " -> Package count: $package_count"
|
||||
|
||||
if [[ $package_count -gt 0 ]]; then
|
||||
print_msg "$GREEN" " -> Average package size: $(du -b *.pkg.tar.* 2>/dev/null | awk '{sum+=$1; count++} END {print sum/count}' | numfmt --to=iec-i --suffix=B)"
|
||||
fi
|
||||
print_info "Repository Disk Usage:"
|
||||
|
||||
cd "$ARCH_DIR"
|
||||
|
||||
local total_size=$(du -sh . 2>/dev/null | cut -f1)
|
||||
local package_count=$(ls -1 *.pkg.tar.* 2>/dev/null | grep -v '\.sig$' | wc -l)
|
||||
|
||||
print_success " -> Total size: $total_size"
|
||||
print_success " -> Package count: $package_count"
|
||||
|
||||
if [[ $package_count -gt 0 ]]; then
|
||||
print_success " -> Average package size: $(du -b *.pkg.tar.* 2>/dev/null | awk '{sum+=$1; count++} END {print sum/count}' | numfmt --to=iec-i --suffix=B)"
|
||||
fi
|
||||
}
|
||||
|
||||
# Main execution
|
||||
main() {
|
||||
print_msg "$BLUE" "================================"
|
||||
print_msg "$BLUE" "Omarchy Repository Cleaner"
|
||||
print_msg "$BLUE" "================================"
|
||||
|
||||
# Parse command line arguments
|
||||
DRY_RUN=false
|
||||
REMOVE_ALL=false
|
||||
SHOW_USAGE=false
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--keep)
|
||||
KEEP_VERSIONS="$2"
|
||||
shift 2
|
||||
;;
|
||||
--dry-run)
|
||||
DRY_RUN=true
|
||||
shift
|
||||
;;
|
||||
--all)
|
||||
REMOVE_ALL=true
|
||||
shift
|
||||
;;
|
||||
--usage)
|
||||
SHOW_USAGE=true
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --keep N Keep N versions of each package (default: 2)"
|
||||
echo " --dry-run Preview what would be removed without removing"
|
||||
echo " --all Remove ALL packages (dangerous!)"
|
||||
echo " --usage Show disk usage statistics"
|
||||
echo " -h, --help Show this help message"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 # Keep 2 versions (default)"
|
||||
echo " $0 --keep 3 # Keep 3 versions"
|
||||
echo " $0 --dry-run # Preview cleanup"
|
||||
echo " $0 --all --dry-run # Preview complete removal"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
print_msg "$RED" "Unknown option: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Validate keep versions
|
||||
if ! [[ "$KEEP_VERSIONS" =~ ^[0-9]+$ ]] || [[ "$KEEP_VERSIONS" -lt 1 ]]; then
|
||||
print_msg "$RED" "Error: --keep must be a positive integer"
|
||||
exit 1
|
||||
print_header "Omarchy Repository Cleaner"
|
||||
|
||||
# Parse command line arguments
|
||||
DRY_RUN=false
|
||||
REMOVE_ALL=false
|
||||
SHOW_USAGE=false
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--keep)
|
||||
KEEP_VERSIONS="$2"
|
||||
shift 2
|
||||
;;
|
||||
--dry-run)
|
||||
DRY_RUN=true
|
||||
shift
|
||||
;;
|
||||
--all)
|
||||
REMOVE_ALL=true
|
||||
shift
|
||||
;;
|
||||
--usage)
|
||||
SHOW_USAGE=true
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --keep N Keep N versions of each package (default: 2)"
|
||||
echo " --dry-run Preview what would be removed without removing"
|
||||
echo " --all Remove ALL packages (dangerous!)"
|
||||
echo " --usage Show disk usage statistics"
|
||||
echo " -h, --help Show this help message"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 # Keep 2 versions (default)"
|
||||
echo " $0 --keep 3 # Keep 3 versions"
|
||||
echo " $0 --dry-run # Preview cleanup"
|
||||
echo " $0 --all --dry-run # Preview complete removal"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
print_error "Unknown option: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Validate keep versions
|
||||
if ! [[ "$KEEP_VERSIONS" =~ ^[0-9]+$ ]] || [[ "$KEEP_VERSIONS" -lt 1 ]]; then
|
||||
print_error "Error: --keep must be a positive integer"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Show dry run notice
|
||||
if [[ "$DRY_RUN" == true ]]; then
|
||||
print_warning "DRY RUN MODE - No changes will be made"
|
||||
fi
|
||||
|
||||
# Execute based on options
|
||||
if [[ "$SHOW_USAGE" == true ]]; then
|
||||
show_disk_usage
|
||||
elif [[ "$REMOVE_ALL" == true ]]; then
|
||||
remove_all_packages "$DRY_RUN"
|
||||
else
|
||||
clean_packages "$KEEP_VERSIONS" "$DRY_RUN"
|
||||
|
||||
# Update database after cleaning (unless dry run)
|
||||
if [[ "$DRY_RUN" != true ]]; then
|
||||
print_info "Updating repository database..."
|
||||
"$BUILD_ROOT/bin/update-repo" >/dev/null 2>&1 && {
|
||||
print_success " -> Database updated successfully!"
|
||||
} || {
|
||||
print_warning " -> Database update failed (may need manual update)"
|
||||
}
|
||||
fi
|
||||
|
||||
# Show dry run notice
|
||||
if [[ "$DRY_RUN" == true ]]; then
|
||||
print_msg "$YELLOW" "DRY RUN MODE - No changes will be made"
|
||||
fi
|
||||
|
||||
# Execute based on options
|
||||
if [[ "$SHOW_USAGE" == true ]]; then
|
||||
show_disk_usage
|
||||
elif [[ "$REMOVE_ALL" == true ]]; then
|
||||
remove_all_packages "$DRY_RUN"
|
||||
else
|
||||
clean_packages "$KEEP_VERSIONS" "$DRY_RUN"
|
||||
|
||||
# Update database after cleaning (unless dry run)
|
||||
if [[ "$DRY_RUN" != true ]]; then
|
||||
print_msg "$BLUE" "\n==> Updating repository database..."
|
||||
"$REPO_DIR/scripts/update-repo.sh" >/dev/null 2>&1 && {
|
||||
print_msg "$GREEN" " -> Database updated successfully!"
|
||||
} || {
|
||||
print_msg "$YELLOW" " -> Database update failed (may need manual update)"
|
||||
}
|
||||
fi
|
||||
|
||||
show_disk_usage
|
||||
fi
|
||||
|
||||
print_msg "$GREEN" "\n==> Cleanup complete!"
|
||||
|
||||
show_disk_usage
|
||||
fi
|
||||
|
||||
echo ""
|
||||
print_success "Cleanup complete!"
|
||||
}
|
||||
|
||||
# Run main function
|
||||
main "$@"
|
||||
main "$@"
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
# Meta command for Omarchy repository management
|
||||
# Usage: ./bin/repo <command> [options]
|
||||
|
||||
set -e
|
||||
|
||||
# Get the directory of this script
|
||||
SCRIPT_DIR=$(realpath "${BASH_SOURCE[0]%/*}")
|
||||
BUILD_ROOT=$(realpath "$SCRIPT_DIR/..")
|
||||
|
||||
# Source common functions
|
||||
source "$BUILD_ROOT/lib/message-helpers.sh"
|
||||
|
||||
# Show usage
|
||||
show_usage() {
|
||||
echo "Usage: $0 <command> [options]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " build Build AUR packages"
|
||||
echo " update Update repository database"
|
||||
echo " clean Clean old package versions"
|
||||
echo " list List packages in repository"
|
||||
echo " remove Remove a specific package"
|
||||
echo " sync Sync repository to remote"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 build # Build all packages"
|
||||
echo " $0 update --clean # Update database (clean rebuild)"
|
||||
echo " $0 clean --dry-run # Preview cleanup"
|
||||
echo " $0 list # List all packages"
|
||||
echo " $0 remove package-name # Remove a package"
|
||||
echo " $0 sync x86_64 # Sync to remote"
|
||||
echo ""
|
||||
echo "For command-specific help, use:"
|
||||
echo " $0 <command> --help"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Check if no command provided
|
||||
if [[ $# -eq 0 ]]; then
|
||||
show_usage
|
||||
fi
|
||||
|
||||
# Get command and shift arguments
|
||||
COMMAND="$1"
|
||||
shift
|
||||
|
||||
# Route to appropriate script
|
||||
case $COMMAND in
|
||||
build)
|
||||
exec "$SCRIPT_DIR/build" "$@"
|
||||
;;
|
||||
update)
|
||||
exec "$SCRIPT_DIR/update-repo" "$@"
|
||||
;;
|
||||
clean)
|
||||
exec "$SCRIPT_DIR/clean-repo" "$@"
|
||||
;;
|
||||
list)
|
||||
exec "$SCRIPT_DIR/list-packages" "$@"
|
||||
;;
|
||||
remove)
|
||||
exec "$SCRIPT_DIR/remove-package" "$@"
|
||||
;;
|
||||
sync)
|
||||
exec "$SCRIPT_DIR/sync-repo" "$@"
|
||||
;;
|
||||
-h | --help | help)
|
||||
show_usage
|
||||
;;
|
||||
*)
|
||||
print_error "Unknown command: $COMMAND"
|
||||
echo ""
|
||||
show_usage
|
||||
;;
|
||||
esac
|
||||
+33
-6
@@ -1,13 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Default remote
|
||||
REMOTE="pkgs.omarchy.org:omarchy-pkgs"
|
||||
# Source common functions
|
||||
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
|
||||
source "$BUILD_ROOT/lib/message-helpers.sh"
|
||||
|
||||
# Default remote (production)
|
||||
DEFAULT_REMOTE="pkgs.omarchy.org:omarchy-pkgs"
|
||||
REMOTE="$DEFAULT_REMOTE"
|
||||
SKIP_PROD_CHECK=false
|
||||
|
||||
# Parse arguments
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $0 [directory] [options]"
|
||||
echo "Usage: $0 <directory> [options]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --remote <remote> Specify rclone remote (default: pkgs.omarchy.org:omarchy-pkgs)"
|
||||
echo " --remote <remote> Specify rclone remote (default: $DEFAULT_REMOTE)"
|
||||
echo " --skip-prod-check Skip production sync confirmation"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 x86_64 # Sync to production (with confirmation)"
|
||||
echo " $0 x86_64 --remote test:bucket # Sync to test remote"
|
||||
echo " $0 x86_64 --skip-prod-check # Sync to production without confirmation"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -21,12 +34,26 @@ while [[ $# -gt 0 ]]; do
|
||||
REMOTE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--skip-prod-check)
|
||||
SKIP_PROD_CHECK=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
print_error "Unknown option: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "Syncing to: $REMOTE"
|
||||
# Check if syncing to production and warn user
|
||||
if [[ "$REMOTE" == "$DEFAULT_REMOTE" ]] && [[ "$SKIP_PROD_CHECK" != true ]]; then
|
||||
print_warning "You are about to sync to PRODUCTION ($REMOTE)"
|
||||
echo ""
|
||||
gum confirm "Are you sure you want to sync to production?" || {
|
||||
print_info "Sync cancelled"
|
||||
exit 0
|
||||
}
|
||||
fi
|
||||
|
||||
print_info "Syncing to: $REMOTE"
|
||||
rclone sync "$DIRECTORY" "$REMOTE/$(basename $DIRECTORY)" --checksum --progress --copy-links --delete-after -v
|
||||
|
||||
+21
-10
@@ -6,7 +6,7 @@ set -e
|
||||
|
||||
# Source common functions
|
||||
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
|
||||
source "$BUILD_ROOT/lib/common.sh"
|
||||
source "$BUILD_ROOT/lib/message-helpers.sh"
|
||||
|
||||
# Repository configuration
|
||||
ARCH_DIR="$BUILD_ROOT/x86_64"
|
||||
@@ -82,18 +82,30 @@ sign_database() {
|
||||
print_info "Signing repository database..."
|
||||
|
||||
# Check if GPG key is available
|
||||
if ! gpg --list-secret-keys 2>/dev/null | grep -q "sec"; then
|
||||
local KEY_ID=$(gpg --list-secret-keys --keyid-format LONG 2>/dev/null | grep "sec" | head -1 | awk '{print $2}' | cut -d'/' -f2)
|
||||
if [[ -z "$KEY_ID" ]]; then
|
||||
print_warning "No GPG key found, skipping signing"
|
||||
print_warning "To enable signing, create a GPG key and configure it"
|
||||
return
|
||||
fi
|
||||
|
||||
# Sign the database
|
||||
gpg --detach-sign --use-agent "$DB_FILE" 2>/dev/null && {
|
||||
print_success "Database signed successfully!"
|
||||
} || {
|
||||
print_warning "Database signing failed (optional)"
|
||||
}
|
||||
# Sign the database using the same method as package signing
|
||||
if [[ -n "$GPG_PASSPHRASE" ]]; then
|
||||
# Use passphrase if available (same as build script)
|
||||
gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
|
||||
--detach-sign --local-user "$KEY_ID" "$DB_FILE" 2>/dev/null && {
|
||||
print_success "Database signed successfully!"
|
||||
} || {
|
||||
print_warning "Database signing failed (optional)"
|
||||
}
|
||||
else
|
||||
# Fall back to agent-based signing
|
||||
gpg --detach-sign --use-agent --local-user "$KEY_ID" "$DB_FILE" 2>/dev/null && {
|
||||
print_success "Database signed successfully!"
|
||||
} || {
|
||||
print_warning "Database signing failed (optional)"
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to generate repository statistics
|
||||
@@ -148,7 +160,7 @@ main() {
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --clean Remove existing database and rebuild from scratch"
|
||||
echo " --clean Remove existing database and rebuild from scratch. Does not remove package files."
|
||||
echo " --verify Only verify the database"
|
||||
echo " --sign Sign the database with GPG"
|
||||
echo " --stats Show repository statistics only"
|
||||
@@ -184,4 +196,3 @@ main() {
|
||||
|
||||
# Run main function
|
||||
main "$@"
|
||||
|
||||
|
||||
+7
-16
@@ -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"]
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
@@ -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
|
||||
|
||||
Executable
+71
@@ -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"
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
# Common printing functions for Omarchy scripts
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
CYAN='\033[0;36m'
|
||||
BOLD='\033[1m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Message printing functions
|
||||
print_info() {
|
||||
echo -e "${BLUE}==>${NC} $1"
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "${GREEN}✓${NC} $1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}✗${NC} $1"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}⚠${NC} $1"
|
||||
}
|
||||
|
||||
print_step() {
|
||||
echo -e " ${BLUE}→${NC} $1"
|
||||
}
|
||||
|
||||
print_header() {
|
||||
echo -e "${BOLD}================================${NC}"
|
||||
echo -e "${BOLD}$1${NC}"
|
||||
echo -e "${BOLD}================================${NC}"
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user