From 25ce522e5ea083662149d86ff2c8f41495f53733 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Mon, 14 Jun 2021 20:16:40 +0200 Subject: [PATCH] update build-pkg scripts --- README.md | 2 +- ...ild-pkg.sh => build-all-without-docker.sh} | 4 ++-- .../{build-pkg-docker.sh => build-all.sh} | 21 ++++++++++++------- build-pkg/docker-compose.yml | 8 ++++++- build-pkg/run.sh | 13 ++++++++++-- 5 files changed, 35 insertions(+), 13 deletions(-) rename build-pkg/{build-pkg.sh => build-all-without-docker.sh} (96%) rename build-pkg/{build-pkg-docker.sh => build-all.sh} (75%) diff --git a/README.md b/README.md index 3aa0d4c..100eba3 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ sudo pacman -U out/de-p1st-repo*.pkg.tar.* Then you can start building all packages and adding them to your mirror-server: ```shell -./build-pkg-docker.sh +./build-all.sh ``` diff --git a/build-pkg/build-pkg.sh b/build-pkg/build-all-without-docker.sh similarity index 96% rename from build-pkg/build-pkg.sh rename to build-pkg/build-all-without-docker.sh index 1309b2e..d291af1 100755 --- a/build-pkg/build-pkg.sh +++ b/build-pkg/build-all-without-docker.sh @@ -82,9 +82,9 @@ function main() { done else # Stage1 - 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 || return $? + 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 || return $? # Stage2 - build-and-push de-p1st-smartcard de-p1st-kernel-default de-p1st-kernel-lts de-p1st-dns || return $? + build-and-push de-p1st-smartcard de-p1st-kernel-default de-p1st-kernel-lts de-p1st-dns de-p1st-ssh || return $? # Stage3 build-and-push de-p1st-base || return $? # Stage4 diff --git a/build-pkg/build-pkg-docker.sh b/build-pkg/build-all.sh similarity index 75% rename from build-pkg/build-pkg-docker.sh rename to build-pkg/build-all.sh index 51093c1..ee89939 100755 --- a/build-pkg/build-pkg-docker.sh +++ b/build-pkg/build-all.sh @@ -28,7 +28,13 @@ function start-docker() { function build-pkg() { # --rm: Remove container after run. - sudo docker-compose run --rm makepkg "${1}" + COMPOSE_ARGS=('run' '--rm' 'makepkg') + if [ "${INTERACTIVE}" = "true" ]; then + COMPOSE_ARGS+=('interactive') + fi + COMPOSE_ARGS+=("${1}") + + sudo docker-compose "${COMPOSE_ARGS[@]}" } function push-pkg() { @@ -46,15 +52,16 @@ function main() { start-docker || return $? is-installed "docker-compose" || return $? -# PKGS=(xorg-meta de-p1st-systemd de-p1st-sudo de-p1st-screen 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-gpu-generic de-p1st-gpu-amdgpu de-p1st-installer de-p1st-repo) -# for PKG in "${PKGS[@]}"; do -# build-pkg "${PKG}" || return $? -# done + if [ "${1}" = "interactive" ]; then + echo "Interactive mode enabled" + INTERACTIVE=true + shift; # remove first argument + fi # Stage1 - 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 || return $? + 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 || return $? # Stage2 - build-and-push de-p1st-smartcard de-p1st-kernel-default de-p1st-kernel-lts de-p1st-dns || return $? + build-and-push de-p1st-smartcard de-p1st-kernel-default de-p1st-kernel-lts de-p1st-dns de-p1st-ssh || return $? # Stage3 build-and-push de-p1st-base || return $? # Stage4 diff --git a/build-pkg/docker-compose.yml b/build-pkg/docker-compose.yml index 047dec5..a1aa682 100644 --- a/build-pkg/docker-compose.yml +++ b/build-pkg/docker-compose.yml @@ -1,7 +1,13 @@ version: '3.7' services: - # usage: sudo docker-compose run --rm makepkg + # 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 makepkg: build: . diff --git a/build-pkg/run.sh b/build-pkg/run.sh index 6750bd4..22c1282 100644 --- a/build-pkg/run.sh +++ b/build-pkg/run.sh @@ -13,10 +13,14 @@ function build-pkg(){ cp -r "${PKG}" /tmp/pkg cd /tmp/pkg + MAKEPKG_ARGS=('--syncdeps') + if [ "${INTERACTIVE}" != "true" ]; then + MAKEPKG_ARGS+=('--noconfirm') # --noconfirm is passed to pacman + fi + # Build the package. - # One could add argument "--noconfirm" to "makepkg" (which will be passed to Pacman) for non-interactive mode. set +e - makepkg --syncdeps + makepkg "${MAKEPKG_ARGS[@]}" saved="$?" set -e @@ -43,6 +47,11 @@ function main(){ # 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