From d405ab7a3eefa6d92dccca986f611b42aa135f63 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Mon, 21 Feb 2022 10:12:50 +0100 Subject: [PATCH] enable users to run build server --- usr/bin/archboot-aarch64-create-repository.sh | 1 - usr/bin/archboot-aarch64-server-release.sh | 1 - usr/bin/archboot-x86_64-create-repository.sh | 1 - usr/bin/archboot-x86_64-server-release.sh | 1 - usr/lib/archboot/bootloader_functions | 7 ++--- usr/lib/archboot/container_functions | 8 ++---- usr/lib/archboot/functions | 20 +++++++------ usr/lib/archboot/iso_functions | 8 +----- usr/lib/archboot/release_functions | 3 +- usr/lib/archboot/repository_functions | 1 + usr/lib/archboot/server_functions | 28 ++++--------------- 11 files changed, 26 insertions(+), 53 deletions(-) diff --git a/usr/bin/archboot-aarch64-create-repository.sh b/usr/bin/archboot-aarch64-create-repository.sh index b0884c66c..10bc169b4 100755 --- a/usr/bin/archboot-aarch64-create-repository.sh +++ b/usr/bin/archboot-aarch64-create-repository.sh @@ -9,7 +9,6 @@ _REPODIR="$(mktemp -d "${1}"/repository.XXX)" _CACHEDIR="${_REPODIR}/var/cache/pacman/pkg" [[ -z "${1}" ]] && _usage _root_check -_buildserver_check _cachedir_check echo "Starting repository creation ..." if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then diff --git a/usr/bin/archboot-aarch64-server-release.sh b/usr/bin/archboot-aarch64-server-release.sh index ca601774e..fa80f32e4 100755 --- a/usr/bin/archboot-aarch64-server-release.sh +++ b/usr/bin/archboot-aarch64-server-release.sh @@ -3,7 +3,6 @@ _ARCH="aarch64" source /usr/lib/archboot/functions source /usr/lib/archboot/server_functions _root_check -_buildserver_check _update_aarch64_pacman_chroot || exit 1 _update_source _server_release || exit 1 diff --git a/usr/bin/archboot-x86_64-create-repository.sh b/usr/bin/archboot-x86_64-create-repository.sh index 40452423b..f311db842 100755 --- a/usr/bin/archboot-x86_64-create-repository.sh +++ b/usr/bin/archboot-x86_64-create-repository.sh @@ -9,7 +9,6 @@ _REPODIR="$(mktemp -d "${1}"/repository.XXX)" _CACHEDIR="${_REPODIR}/var/cache/pacman/pkg" [[ -z "${1}" ]] && _usage _root_check -_buildserver_check _x86_64_pacman_use_default || exit 1 _cachedir_check _x86_64_check diff --git a/usr/bin/archboot-x86_64-server-release.sh b/usr/bin/archboot-x86_64-server-release.sh index 33e554e2b..b1113736b 100755 --- a/usr/bin/archboot-x86_64-server-release.sh +++ b/usr/bin/archboot-x86_64-server-release.sh @@ -3,7 +3,6 @@ _ARCH="x86_64" source /usr/lib/archboot/functions source /usr/lib/archboot/server_functions _root_check -_buildserver_check _update_source _x86_64_pacman_use_default || exit 1 _server_release || exit 1 diff --git a/usr/lib/archboot/bootloader_functions b/usr/lib/archboot/bootloader_functions index 10607ed42..5cc93f15a 100644 --- a/usr/lib/archboot/bootloader_functions +++ b/usr/lib/archboot/bootloader_functions @@ -1,17 +1,14 @@ #!/bin/bash # created by Tobias Powalowski +source /etc/archboot/defaults +# fedora shim setup _SHIM_VERSION="15.4" _SHIM_RELEASE="5" _SHIM_URL="https://kojipkgs.fedoraproject.org/packages/shim/${_SHIM_VERSION}/${_SHIM_RELEASE}" _SHIM_RPM="x86_64/shim-x64-${_SHIM_VERSION}-${_SHIM_RELEASE}.x86_64.rpm" _SHIM32_RPM="x86_64/shim-ia32-${_SHIM_VERSION}-${_SHIM_RELEASE}.x86_64.rpm" _SHIM_AA64_RPM="aarch64/shim-aa64-${_SHIM_VERSION}-${_SHIM_RELEASE}.aarch64.rpm" -_USER="tobias" -_GROUP="users" -_GPG="--detach-sign --no-armor --batch --passphrase-file /etc/archboot/gpg.passphrase --pinentry-mode loopback -u 7EDF681F" -_SERVER="pkgbuild.com" _ARCH_SERVERDIR="/home/tpowa/public_html/archboot-helper/bootloader" -_GRUB_CONFIG="/usr/share/archboot/grub/grub.cfg" _prepare_shim_files () { # download packages from fedora server diff --git a/usr/lib/archboot/container_functions b/usr/lib/archboot/container_functions index 7beec5201..28379bf34 100644 --- a/usr/lib/archboot/container_functions +++ b/usr/lib/archboot/container_functions @@ -1,10 +1,6 @@ #!/bin/bash # created by Tobias Powalowski -_CLEANUP_CACHE="" -_CLEANUP_CONTAINER="" -_LINUX_FIRMWARE="linux-firmware" -_PACMAN_AARCH64_CHROOT_SERVER="https://pkgbuild.com/~tpowa/archboot-helper/pacman-aarch64-chroot" -_PACMAN_AARCH64_CHROOT="pacman-aarch64-chroot-latest.tar.zst" +source /etc/archboot/defaults _usage () { echo "CREATE ARCHBOOT CONTAINER" @@ -39,7 +35,7 @@ _clean_cache() { _aarch64_pacman_chroot() { echo "Downloading archlinuxarm pacman aarch64 chroot..." - [[ -f pacman-aarch64-chroot-latest.tar.zst ]] || wget ${_PACMAN_AARCH64_CHROOT_SERVER}/${_PACMAN_AARCH64_CHROOT}{,.sig} >/dev/null 2>&1 + [[ -f pacman-aarch64-chroot-latest.tar.zst ]] || wget ${_PACMAN_AARCH64_CHROOT_PUBLIC}/${_PACMAN_AARCH64_CHROOT}{,.sig} >/dev/null 2>&1 # verify dowload sleep 1 gpg --verify "${_PACMAN_AARCH64_CHROOT}.sig" >/dev/null 2>&1 || exit 1 diff --git a/usr/lib/archboot/functions b/usr/lib/archboot/functions index b1cfdd8da..2c89c811e 100644 --- a/usr/lib/archboot/functions +++ b/usr/lib/archboot/functions @@ -1,7 +1,7 @@ #!/bin/bash # created by Tobias Powalowski -# change to english locale! -export LANG="C" +source /etc/archboot/defaults +LANG="C" _BASENAME="$(basename "${0}")" _RUNNING_ARCH="$(uname -m)" _PACMAN_MIRROR="/etc/pacman.d/mirrorlist" @@ -55,15 +55,19 @@ _generate_keyring() { _x86_64_pacman_use_default() { # use pacman.conf with disabled [testing] repository - cp "${_PACMAN_CONF}" "${_PACMAN_CONF}".old - cp "${_PACMAN_CONF}".archboot "${_PACMAN_CONF}" + if ! [[ "${CUSTOM_PACMAN_CONF}" = "" ]]; then + cp "${_PACMAN_CONF}" "${_PACMAN_CONF}".old + cp "${CUSTOM_PACMAN_CONF}" "${_PACMAN_CONF}" + fi # use mirrorlist with enabled rackspace mirror - cp "${_PACMAN_MIRROR}" "${_PACMAN_MIRROR}".old - cp "${_PACMAN_MIRROR}".archboot "${_PACMAN_MIRROR}" + if ! [[ "${CUSTOM_MIRRORLIST}" = "" ]]; then + cp "${_PACMAN_MIRROR}" "${_PACMAN_MIRROR}".old + cp "${_CUSTOM_MIRRORLIST}" "${_PACMAN_MIRROR}" + fi } _x86_64_pacman_restore() { # restore pacman.conf and mirrorlist - cp "${_PACMAN_MIRROR}".old "${_PACMAN_MIRROR}" - cp "${_PACMAN_CONF}".old "${_PACMAN_CONF}" + [[ -z "${CUSTOM_PACMAN_CONF}" ]] || cp "${_PACMAN_MIRROR}".old "${_PACMAN_MIRROR}" + [[ -z "${CUSTOM_MIRRORLIST}" ]] || cp "${_PACMAN_CONF}".old "${_PACMAN_CONF}" } diff --git a/usr/lib/archboot/iso_functions b/usr/lib/archboot/iso_functions index b0cc79bce..c143a0c62 100644 --- a/usr/lib/archboot/iso_functions +++ b/usr/lib/archboot/iso_functions @@ -1,13 +1,7 @@ #!/bin/bash # created by Tobias Powalowski +source /etc/archboot/defaults _PRESET_DIR="/etc/archboot/presets" -_GRUB_CONFIG="/usr/share/archboot/grub/grub.cfg" -# covered by usage -_GENERATE="" -_PRESET="" -_IMAGENAME="" -_RELEASENAME="" -# temporary directories _ISODIR="$(mktemp -d ISODIR.XXX)" _usage () { diff --git a/usr/lib/archboot/release_functions b/usr/lib/archboot/release_functions index 454b62c3d..a87b284fd 100644 --- a/usr/lib/archboot/release_functions +++ b/usr/lib/archboot/release_functions @@ -1,12 +1,13 @@ #!/bin/bash # created by Tobias Powalowski -_PRESET_LATEST="${_ARCH}-latest" +source /etc/archboot/defaults _AMD_UCODE="boot/amd-ucode.img" _INTEL_UCODE="boot/intel-ucode.img" _INITRAMFS="boot/initramfs_${_ARCH}.img" _INITRAMFS_LATEST="boot/initramfs_${_ARCH}-latest.img" _KERNEL="boot/vmlinuz_${_ARCH}" _KERNEL_ARCHBOOT="boot/vmlinuz_archboot_${_ARCH}" +_PRESET_LATEST="${_ARCH}-latest" _W_DIR="$(mktemp -u archboot-release.XXX)" _usage () { diff --git a/usr/lib/archboot/repository_functions b/usr/lib/archboot/repository_functions index 14e123e74..be2c7bd8d 100644 --- a/usr/lib/archboot/repository_functions +++ b/usr/lib/archboot/repository_functions @@ -1,5 +1,6 @@ #!/bin/bash # created by Tobias Powalowski +source /etc/archboot/defaults _usage () { echo "CREATE ARCHBOOT REPOSITORY" diff --git a/usr/lib/archboot/server_functions b/usr/lib/archboot/server_functions index 787537895..548001263 100644 --- a/usr/lib/archboot/server_functions +++ b/usr/lib/archboot/server_functions @@ -1,24 +1,7 @@ #!/bin/bash # created by Tobias Powalowski -_DIR="$(date +%Y.%m)" -_ISO_HOME="/home/tobias/Arch/iso" -_ISO_HOME_ARCH="${_ISO_HOME}/${_ARCH}" -_ISO_HOME_SOURCE="${_ISO_HOME}/${_ARCH}/sources/${_DIR}" +source /etc/archboot/defaults _ISO_BUILD_DIR="$(mktemp -d "${_ISO_HOME_ARCH}"/server-release.XXX)" -_SERVER="pkgbuild.com" -_SERVER_HOME="/home/tpowa" -_SERVER_PUBLIC="${_SERVER_HOME}/public_html" -_SERVER_IMAGE_DIR="${_SERVER_PUBLIC}/archboot-images" -_SERVER_SOURCE_DIR="${_SERVER_PUBLIC}/archboot-sources" -_ARCHBOOT_PUBLIC="https://pkgbuild.com/~tpowa" -_ARCHBOOT_SOURCE="${_ARCHBOOT_PUBLIC}/archboot-sources" -_PACMAN_AARCH64="pacman-aarch64-chroot" -_PACMAN_AARCH64_CHROOT="${_PACMAN_AARCH64}-latest.tar.zst" -_PACMAN_AARCH64_CHROOT_PUBLIC="${_ARCHBOOT_PUBLIC}/archboot-helper/${_PACMAN_AARCH64}" -_PACMAN_AARCH64_SERVER="${_SERVER_PUBLIC}/archboot-helper/${_PACMAN_AARCH64}" -_USER="tobias" -_GROUP="users" -_GPG="--detach-sign --no-armor --batch --passphrase-file /etc/archboot/gpg.passphrase --pinentry-mode loopback -u 7EDF681F" _update_aarch64_pacman_chroot() { # update aarch64 pacman chroot @@ -26,7 +9,7 @@ _update_aarch64_pacman_chroot() { [[ -d "${_PACMAN_AARCH64}" ]] || mkdir "${_PACMAN_AARCH64}" echo "Downloading archlinuxarm pacman aarch64 chroot..." [[ -f pacman-aarch64-chroot-latest.tar.zst ]] && rm pacman-aarch64-chroot-latest.tar.zst{,.sig} - wget ${_PACMAN_AARCH64_CHROOT_PUBLIC}/${_PACMAN_AARCH64_CHROOT}{,.sig} >/dev/null 2>&1 + wget ${_ARCHBOOT_AARCH64_CHROOT_PUBLIC}/${_PACMAN_AARCH64_CHROOT}{,.sig} >/dev/null 2>&1 # verify dowload sudo -u "${_USER}" gpg --verify "${_PACMAN_AARCH64_CHROOT}.sig" >/dev/null 2>&1 || exit 1 bsdtar -C "${_PACMAN_AARCH64}" -xf "${_PACMAN_AARCH64_CHROOT}" >/dev/null 2>&1 @@ -54,8 +37,8 @@ _update_aarch64_pacman_chroot() { #shellcheck disable=SC2086 sudo -u "${_USER}" gpg ${_GPG} "${_PACMAN_AARCH64_CHROOT}" chown "${_USER}:${_GROUP}" ${_PACMAN_AARCH64_CHROOT}{,.sig} - echo "Uploading files to ${_SERVER}:${_PACMAN_AARCH64_SERVER} ..." - sudo -u "${_USER}" scp -q ${_PACMAN_AARCH64_CHROOT}{,.sig} ${_SERVER}:${_PACMAN_AARCH64_SERVER} || exit 1 + echo "Uploading files to ${_SERVER}:${_SERVER_PACMAN_AARCH64} ..." + sudo -u "${_USER}" scp -q ${_PACMAN_AARCH64_CHROOT}{,.sig} ${_SERVER}:${_SERVER_PACMAN_AARCH64} || exit 1 } _update_source() { @@ -67,13 +50,14 @@ _update_source() { fi echo "Creating ${_ARCH} archboot repository ..." "archboot-${_ARCH}-create-repository.sh" "${_ISO_HOME_SOURCE}" || exit 1 + chown -R "${_USER}:${_GROUP}" "${_ISO_HOME_SOURCE}" echo "Uploading files to ${_SERVER}:${_SERVER_HOME}/${_ARCH} ..." #shellcheck disable=SC2086 sudo -u "${_USER}" ssh "${_SERVER}" "[[ -d "${_SERVER_HOME}/${_ARCH}" ]] || mkdir -p ${_SERVER_HOME}/${_ARCH}" sudo -u "${_USER}" scp -q -r "${_ISO_HOME_SOURCE}" "${_SERVER}":"${_SERVER_HOME}/${_ARCH}" || exit 1 sudo -u "${_USER}" ssh "${_SERVER}" <