Browse Source

pkgbuilder

Signed-off-by: fbt <fbt@fleshless.org>
master
Jack L. Frost 1 year ago
parent
commit
f9ebd51193
1 changed files with 106 additions and 0 deletions
  1. +106
    -0
      pkgbuilder

+ 106
- 0
pkgbuilder View File

@ -0,0 +1,106 @@
#!/usr/bin/env bash
err() { printf '%s\n' "$*" >&2; }
build_remote() { sudo makepkg-overlay "$@"; }
cleanup() { rm -f "$lockfile"; }
lock() {
[[ -f "$lockfile" ]] && {
printf 'Lockfile found: %s\n' "$lockfile" >&2
return 1
}
echo $$ > "$lockfile"
lock_pid=$(<"$lockfile")
[[ $$ == "$lock_pid" ]] || return 1
}
# Ensure one instance
lockfile="$HOME/.cache/pkgbuilder/.lock"
lock || exit 1
trap cleanup EXIT
spark_repos="$HOME/public"
declare -A pkg_dests
pkg_dests=(
[spark]="$spark_repos/spark/import"
[spark-extra]="$spark_repos/spark-extra/import"
[spark-testing]="$spark_repos/spark-testing/import"
[spark-updates]="$spark_repos/spark-updates/spark/import"
)
repos=(
spark "https://code.fleshless.org/pkgbuilds/sinit-spark"
spark "https://code.fleshless.org/pkgbuilds/sinit-sysvcompat"
spark "https://code.fleshless.org/pkgbuilds/smdev"
spark "https://code.fleshless.org/pkgbuilds/spark-etc"
spark "https://code.fleshless.org/pkgbuilds/spark-rc"
spark "https://code.fleshless.org/pkgbuilds/ssm"
spark "https://code.fleshless.org/pkgbuilds/ssm-services-git"
spark "https://code.fleshless.org/pkgbuilds/systemd-dummy"
spark "https://code.fleshless.org/pkgbuilds/ubase-extras"
spark "https://code.fleshless.org/pkgbuilds/udev-dummy"
spark "https://code.fleshless.org/pkgbuilds/xorg-noudev-conf"
spark-extra "https://code.fleshless.org/pkgbuilds/anope-services"
spark-extra "https://code.fleshless.org/pkgbuilds/chef-client"
spark-extra "https://code.fleshless.org/pkgbuilds/dmenu-q-xywh-xft-git"
spark-extra "https://code.fleshless.org/pkgbuilds/dxvk-bin"
spark-extra "https://code.fleshless.org/pkgbuilds/eudev"
spark-extra "https://code.fleshless.org/pkgbuilds/fake"
spark-extra "https://code.fleshless.org/pkgbuilds/graphicsmagick-webp"
spark-extra "https://code.fleshless.org/pkgbuilds/ircd-ratbox"
spark-extra "https://code.fleshless.org/pkgbuilds/lemonbar"
spark-extra "https://code.fleshless.org/pkgbuilds/libsystemd-standalone"
spark-extra "https://code.fleshless.org/pkgbuilds/loksh"
spark-extra "https://code.fleshless.org/pkgbuilds/mlmmj"
spark-extra "https://code.fleshless.org/pkgbuilds/nginx-mod-rtmp"
spark-extra "https://code.fleshless.org/pkgbuilds/posh"
spark-extra "https://code.fleshless.org/pkgbuilds/prm"
spark-extra "https://code.fleshless.org/pkgbuilds/qstat"
spark-extra "https://code.fleshless.org/pkgbuilds/scron"
spark-extra "https://code.fleshless.org/pkgbuilds/sx-utils"
spark-extra "https://code.fleshless.org/pkgbuilds/systemd-libs-systemd"
spark-extra "https://code.fleshless.org/pkgbuilds/ufw-tools"
spark-extra "https://code.fleshless.org/pkgbuilds/xkb-layout-ducky-mini"
spark-extra "https://code.fleshless.org/pkgbuilds/xsct-git"
spark-testing "https://code.fleshless.org/pkgbuilds/compton-git"
spark-testing "https://code.fleshless.org/pkgbuilds/fskit-git"
spark-testing "https://code.fleshless.org/pkgbuilds/ssm-git"
spark-testing "https://code.fleshless.org/pkgbuilds/xtitle-git"
)
wrkdir="$HOME/.cache/pkgbuilder/repositories"
mkdir -p "$wrkdir"
set -- "${repos[@]}"
while (($#>1)); do
pkg_repo=$2
pkg_dest="${pkg_dests[$1]}"
repo_name="${pkg_repo##*/}"
repo_path="${pkg_repo##*://}"
repo_local="$wrkdir/${repo_path%.git}"
err "repo: $repo_local"
err " - url: $pkg_repo"
# Check if the repo already exists
if ! [[ -d "$repo_local" ]]; then
mkdir -p "$wrkdir/${repo_path%$repo_name}"
git clone "$pkg_repo" "$repo_local"
build_remote "$pkg_repo" "$pkg_dest"
else
git -C "$repo_local" remote update
if git -C "$repo_local" status --porcelain -bu | grep -q behind; then
build_remote "$pkg_repo" "$pkg_dest"
git -C "$repo_local" pull
fi
fi
shift 2
done

Loading…
Cancel
Save