File sync_upstream.sh of Package kernel-source

#!/bin/bash

# Config
REPO_DIR="$HOME/Documents/kernel-source"  # Change to your local clone path
UPSTREAM_URL="https://src.opensuse.org/pool/kernel-source.git"
BRANCH="factory"

cd "$REPO_DIR" || exit 1

echo ">>> Fetching upstream..."
# Add upstream if missing
git remote get-url upstream >/dev/null 2>&1 || git remote add upstream "$UPSTREAM_URL"
git fetch upstream

echo ">>> Checking out $BRANCH..."
git checkout "$BRANCH"

echo ">>> Merging upstream/$BRANCH..."
git merge "upstream/$BRANCH" --no-edit

echo ">>> Pushing to origin..."
git push origin "$BRANCH"

echo ">>> Done! Synced at $(date)"
openSUSE Build Service is sponsored by