diff --git a/.gitignore b/.gitignore index 882b378..88b3553 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ /build-iso/out/ /build-pkg/out/ +/build-pkg/*.tmp diff --git a/build-pkg/build-all-without-docker.sh b/build-pkg/build-all-without-docker.sh index 1ab33a9..c8ab35b 100755 --- a/build-pkg/build-all-without-docker.sh +++ b/build-pkg/build-all-without-docker.sh @@ -1,5 +1,7 @@ #!/bin/bash +echo "Please consider using ./build-all.sh instead. This script is outdated." + function build-with-aurutils() { aur build -c } diff --git a/build-pkg/build-all.sh b/build-pkg/build-all.sh index 9038edd..8959092 100755 --- a/build-pkg/build-all.sh +++ b/build-pkg/build-all.sh @@ -18,7 +18,7 @@ function start-docker() { # Docker service is inactive -> Let's start it echo "Starting docker service ..." sudo systemctl start docker || return $? - sleep 5s + sleep 5s || return $? ;; *) echo "Unknown state or error!" @@ -27,14 +27,17 @@ function start-docker() { } function build-pkg() { - # --rm: Remove container after run. - COMPOSE_ARGS=('run' '--rm' 'makepkg') - if [ "${INTERACTIVE}" = "true" ]; then - COMPOSE_ARGS+=('interactive') - fi - COMPOSE_ARGS+=("${1}") + # $1: package-name + # $2, $3, ...: makepkg-args - sudo docker-compose "${COMPOSE_ARGS[@]}" + # --rm: Remove container after run. + COMPOSE_ARGS=('run' '--rm' 'makepkg' "${1}") || return $? + + if [ ${#MAKEPKG_ARGS[@]} -gt 0 ]; then + COMPOSE_ARGS+=("${MAKEPKG_ARGS[@]}") || return $? + fi + + sudo docker-compose "${COMPOSE_ARGS[@]}" || return $? } function push-pkg() { @@ -62,16 +65,31 @@ function space_separated_to_array() { } function main() { - start-docker || return $? - is-installed "docker-compose" || return $? - if [ "${1}" = "interactive" ]; then - echo "Interactive mode enabled" - INTERACTIVE=true - shift; # remove first argument - fi + # parse arguments + { + if [ $# -lt 1 ]; then + echo "Usage: ${0} [] +With PKGLIST-FILE a file containing zero or more package names in each line, separated by space. +All packages in a line will be built sequentially and are then synced to the remote repository +before continuing with the next line."; + exit 1; + fi - PKGLIST=pkglist-de-p1st.txt # TODO + PKGLIST="${1}" + shift; # remove first arg + MAKEPKG_ARGS=("$@") + } + + # check dependencies and start services + { + start-docker || return $? + is-installed "docker-compose" || return $? + } + + + # Read content of PKGLIST file to an array + # For each line: build and push all space separated packages mapfile -t STAGES < "${PKGLIST}" # shellcheck disable=SC2034 for line in "${STAGES[@]}"; do diff --git a/build-pkg/docker-compose.yml b/build-pkg/docker-compose.yml index a1aa682..b2f50f7 100644 --- a/build-pkg/docker-compose.yml +++ b/build-pkg/docker-compose.yml @@ -2,12 +2,11 @@ version: '3.7' services: # usage: - # - use PKGBUILD found in /pkg - # sudo docker-compose run --rm makepkg - # sudo docker-compose run --rm makepkg interactive - # - use PKGBUILD found in /pkg/ - # sudo docker-compose run --rm makepkg - # sudo docker-compose run --rm makepkg interactive + # If desired, adjust "DEFAULT_MAKEPKG_ARGS" in "run.sh" + # Build the docker container with: + # sudo docker-compose build --pull + # Then build a package with: + # sudo docker-compose run --rm makepkg [] makepkg: build: . diff --git a/build-pkg/run.sh b/build-pkg/run.sh index dcf5fb0..327ff5d 100644 --- a/build-pkg/run.sh +++ b/build-pkg/run.sh @@ -1,27 +1,46 @@ #!/bin/bash -# -# For each ARG in ARGUMENTS -# build /pkg/$ARG/PKGBUILD -# and store the built package at /out/ -# -# If no ARGUMENTS are given, then fallback to path /pkg/PKGBUILD -# set -e +DEFAULT_MAKEPKG_ARGS=('--syncdeps' '--noconfirm') + +################################# + +function main(){ + # Write-permission for user "build" + sudo chown "build:wheel" /out + + # Refresh mirrors + # TODO: Move this to the Dockerfile? + sudo pacman -Sy + + PKG=/pkg/"${1}" + shift; # remove first arg + echo "Looking for PKGBUILD in ${PKG} ..." + + build-pkg "$@" + + # Ensure permissions match those of the original PKGBUILD. + sudo chown "$(stat -c '%u:%g' "${PKG}"/PKGBUILD)" /out/*.pkg.tar.* +} + function build-pkg(){ - # Make a copy as "/pkg" might be read-only and we do not want to alter it + # Make a copy as we don't want to change stuff inside "/pkg" cp -r "${PKG}" /tmp/pkg cd /tmp/pkg - MAKEPKG_ARGS=('--syncdeps') - if [ "${INTERACTIVE}" != "true" ]; then - MAKEPKG_ARGS+=('--noconfirm') # --noconfirm is passed to pacman + MAKEPKG_ARGS=() + if [ "${#DEFAULT_MAKEPKG_ARGS[@]}" -gt 0 ]; then + MAKEPKG_ARGS+=("$@") + fi + if [ $# -gt 0 ]; then + MAKEPKG_ARGS+=("$@") fi # Build the package. + echo "Running: makepkg ${MAKEPKG_ARGS[*]}" + # Disable exit on error as we manually check the exit status in a switch-case set +e - makepkg "${MAKEPKG_ARGS[@]}" - saved="$?" + makepkg "${MAKEPKG_ARGS[@]}"; saved="$?"; set -e case "${saved}" in @@ -41,32 +60,4 @@ function build-pkg(){ esac } -function main(){ - # Write-permission for user "build" - sudo chown "build:wheel" /out - - # Refresh mirrors - sudo pacman -Sy - - if [ "${1}" = "interactive" ]; then - INTERACTIVE=true - shift; # remove first argument - fi - - # If first argument is zero, use default directory - if [ -z "${1}" ]; then - PKG=/pkg - echo "No argument given. Using default directory ${PKG} to look for PKGBUILD ..." - # Else append argument $1 as relative path - else - PKG=/pkg/"${1}" - echo "Looking for PKGBUILD in ${PKG} ..." - fi - - build-pkg - - # Ensure permissions match those of the original PKGBUILD. - sudo chown "$(stat -c '%u:%g' "${PKG}"/PKGBUILD)" /out/*.pkg.tar.* -} - main "$@" diff --git a/pkg/de-p1st-installer/PKGBUILD b/pkg/de-p1st-installer/PKGBUILD index cf6aee7..1075667 100644 --- a/pkg/de-p1st-installer/PKGBUILD +++ b/pkg/de-p1st-installer/PKGBUILD @@ -2,7 +2,7 @@ _pkgname=installer _reponame=arch pkgname="de-p1st-$_pkgname" -pkgver=0.1.11 +pkgver=0.1.12 pkgrel=1 pkgdesc="Bash script to install Arch Linux" arch=('any') @@ -10,6 +10,7 @@ url="https://codeberg.org/privacy1st/${_reponame}" license=('MIT') depends=('dialog') makedepends=('git') +backup=(etc/"${pkgname}"/installer.cfg) # Use relative paths without leading slash source=("git+${url}.git") sha256sums=('SKIP') diff --git a/pkg/holo b/pkg/holo index 62cca9d..1824047 160000 --- a/pkg/holo +++ b/pkg/holo @@ -1 +1 @@ -Subproject commit 62cca9db19cc12ace23ce02daeb07b0f1432de62 +Subproject commit 1824047a640ddbe8f22231cafd2c1fee89e74e63 diff --git a/pkg/jellyfin-bin b/pkg/jellyfin-bin index 4e70553..f307465 160000 --- a/pkg/jellyfin-bin +++ b/pkg/jellyfin-bin @@ -1 +1 @@ -Subproject commit 4e705538c72e7d2c3d7fc4fd312452ebdbf3322d +Subproject commit f30746503aedd0ab397641dc37b464c33a95ab74