#!/bin/bash # Exit if any command fails set -e # 1. Build and install the packages as you normally do # -s: sync dependencies, -i: install after build, -f: overwrite existing makepkg -sif # 2. Extract version info dynamically from the PKGBUILD VERSION=$(grep '^pkgver=' PKGBUILD | cut -d= -f2) REL=$(grep '^pkgrel=' PKGBUILD | cut -d= -f2) FULL_VER="${VERSION}-${REL}-x86_64" # 3. Define the path to your Git repository (adjust if different) GIT_REPO_PATH="./git-repo" mkdir -p "$GIT_REPO_PATH" # 4. Define the packages to track targets=("linux-tom" "linux-tom-headers" "linux-tom-docs") for name in "${targets[@]}"; do actual_file="${name}-${FULL_VER}.pkg.tar.zst" if [ -f "$actual_file" ]; then echo "Updating $name in Git repository..." # Overwrite the generic file name in the Git repo # This keeps the filename stable for Git-LFS cp "$actual_file" "$GIT_REPO_PATH/${name}.pkg.tar.zst" # Update a small metadata file so you still know the version echo "$FULL_VER" > "$GIT_REPO_PATH/${name}.version" else echo "Warning: $actual_file was not found." fi done # 5. Commit to Git cd "$GIT_REPO_PATH" git add *.pkg.tar.zst *.version git commit -m "Kernel Update: $FULL_VER"