2021-04-29 14:49:02 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-05-02 19:45:37 +02:00
|
|
|
function build-with-aurutils() {
|
|
|
|
aur build -c
|
|
|
|
}
|
|
|
|
|
|
|
|
function build-with-makepkg() {
|
|
|
|
makepkg -Ccsr
|
|
|
|
|
|
|
|
case "$?" in
|
|
|
|
0)
|
|
|
|
# Copy the build package to /home/custompkgs
|
2021-05-02 20:04:20 +02:00
|
|
|
cp --no-clobber "${PKG}-"*.pkg.tar.zst /home/custompkgs/ || return $?
|
2021-05-02 19:45:37 +02:00
|
|
|
;;
|
|
|
|
13)
|
|
|
|
# Exit code 13: A package has already been built.
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# Some other makepkg error occurred.
|
|
|
|
return 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2021-04-29 14:49:02 +02:00
|
|
|
function build-pkg() {
|
|
|
|
# $1: package-name
|
|
|
|
local PKG
|
|
|
|
PKG="$1"
|
|
|
|
|
2021-05-02 19:45:37 +02:00
|
|
|
# Check if PKGBUILD exists, otherwise skip
|
2021-06-12 11:55:25 +02:00
|
|
|
[ -f "../pkg/${PKG}/PKGBUILD" ] || {
|
|
|
|
echo "Directory ../pkg/${PKG} does not contain a PKGBUILD file - skipping it!";
|
2021-05-11 22:34:00 +02:00
|
|
|
SKIPPED_PKGS+=("${PKG}");
|
2021-05-02 19:25:48 +02:00
|
|
|
return 0;
|
2021-04-29 14:49:02 +02:00
|
|
|
}
|
|
|
|
|
2021-06-12 11:55:25 +02:00
|
|
|
cd "../pkg/${PKG}" || return $?
|
2021-04-29 14:49:02 +02:00
|
|
|
|
2021-05-02 19:45:37 +02:00
|
|
|
# Build and copy to /home/custompkgs
|
2021-05-03 16:24:25 +02:00
|
|
|
# build-with-makepkg || {
|
|
|
|
build-with-aurutils || {
|
2021-05-02 19:25:48 +02:00
|
|
|
echo "Failed to build package ${PKG}!";
|
2021-05-11 22:34:00 +02:00
|
|
|
return 1
|
2021-05-02 18:02:20 +02:00
|
|
|
}
|
2021-04-29 14:52:03 +02:00
|
|
|
|
2021-06-12 11:55:25 +02:00
|
|
|
cd ../../build-pkg || return $?
|
2021-04-29 14:49:02 +02:00
|
|
|
}
|
|
|
|
|
2021-05-11 22:34:00 +02:00
|
|
|
function push-pkg() {
|
|
|
|
arch-repo-push-new || return $? # Push remote repository
|
|
|
|
echo "Running 'pacman -Sy' to update de-p1st mirror database ..."
|
|
|
|
sudo pacman -Sy || return $?
|
2021-04-29 14:49:02 +02:00
|
|
|
}
|
|
|
|
|
2021-05-13 19:28:31 +02:00
|
|
|
function build-and-push() {
|
|
|
|
for PKG in "$@"; do
|
|
|
|
build-pkg "${PKG}" || return $?
|
|
|
|
done
|
|
|
|
push-pkg || return $?
|
|
|
|
}
|
|
|
|
|
2021-04-29 14:49:02 +02:00
|
|
|
function main() {
|
2021-05-02 19:45:37 +02:00
|
|
|
# Usage:
|
2021-05-11 22:34:00 +02:00
|
|
|
# Without arguments: Build all packages and watch out for dependencies between them:
|
|
|
|
# First build packages on wich others depend
|
|
|
|
# Then add them to de-p1st mirror
|
|
|
|
# And repeat these steps until all packages are built
|
|
|
|
# First argument "all": Build all packages, ordered by name
|
|
|
|
# Multiple arguments: Build the the specified packages in their given order
|
|
|
|
|
|
|
|
SKIPPED_PKGS=()
|
|
|
|
|
|
|
|
if [ "$1" = "all" ]; then
|
2021-06-12 11:55:25 +02:00
|
|
|
for PKG in ../pkg/*; do
|
2021-05-11 22:34:00 +02:00
|
|
|
build-pkg "$(basename "${PKG}")" || return $?
|
|
|
|
done
|
|
|
|
elif [ "$#" -gt "0" ]; then
|
|
|
|
# List of packages is given as arguments
|
2021-04-29 14:49:02 +02:00
|
|
|
for PKG in "$@"; do
|
|
|
|
build-pkg "$PKG" || return $?
|
|
|
|
done
|
|
|
|
else
|
2021-05-13 19:28:31 +02:00
|
|
|
# Stage1
|
2021-06-16 16:36:59 +02:00
|
|
|
build-and-push xorg-meta de-p1st-locale de-p1st-systemd de-p1st-sudo de-p1st-screen de-p1st-htop de-p1st-pacman de-p1st-pacman-mirrorlist de-p1st-networkmanager de-p1st-ucode-placeholder de-p1st-ucode-intel de-p1st-ucode-amd de-p1st-nano de-p1st-mkinitcpio de-p1st-makepkg de-p1st-grub de-p1st-font de-p1st-keyboard-de de-p1st-keyboard-x11-de de-p1st-gnupg de-p1st-redshift de-p1st-theme de-p1st-sddm-autologin-placeholder de-p1st-sddm-autologin-yoda de-p1st-sddm-theme-default de-p1st-sddm-theme-nordic de-p1st-gpu-generic de-p1st-gpu-amdgpu de-p1st-installer de-p1st-repo de-p1st-ssh-key-placeholder de-p1st-ssh-key-yoda \
|
|
|
|
xournalpp-git qt-installer-framework nordic-kde-git \
|
|
|
|
|| return $?
|
2021-05-13 19:28:31 +02:00
|
|
|
# Stage2
|
2021-06-16 16:36:59 +02:00
|
|
|
build-and-push de-p1st-smartcard de-p1st-kernel-default de-p1st-kernel-lts de-p1st-dns de-p1st-ssh \
|
|
|
|
riseup-vpn \
|
|
|
|
|| return $?
|
2021-05-13 19:28:31 +02:00
|
|
|
# Stage3
|
|
|
|
build-and-push de-p1st-base || return $?
|
|
|
|
# Stage4
|
|
|
|
build-and-push de-p1st-xfce4 || return $?
|
|
|
|
# Stage5
|
|
|
|
build-and-push de-p1st-xfce4-hidpi || return $?
|
2021-04-29 14:49:02 +02:00
|
|
|
fi
|
|
|
|
|
2021-05-11 22:34:00 +02:00
|
|
|
push-pkg || return $?
|
2021-05-02 18:02:20 +02:00
|
|
|
|
|
|
|
if [ "${#FAILED_PKGS[@]}" -gt "0" ]; then
|
|
|
|
echo ""
|
2021-05-11 22:34:00 +02:00
|
|
|
echo "Warning: Some packages were skipped: ${SKIPPED_PKGS[*]}"
|
2021-05-02 18:02:20 +02:00
|
|
|
return 1
|
|
|
|
fi
|
2021-04-29 14:49:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|