export variables and unset them

This commit is contained in:
Tobias Powalowski 2022-02-08 20:41:57 +01:00
parent eed6a2914b
commit bff93a775b
8 changed files with 36 additions and 28 deletions

View file

@ -2,10 +2,8 @@
# created by Tobias Powalowski <tpowa@archlinux.org> # created by Tobias Powalowski <tpowa@archlinux.org>
source /usr/lib/archboot/functions source /usr/lib/archboot/functions
source /usr/lib/archboot/container_functions source /usr/lib/archboot/container_functions
_PACMAN_AARCH64_CHROOT_SERVER="https://pkgbuild.com/~tpowa/archboot-helper/pacman-chroot-aarch64" export _ARCHBOOT="archboot-arm"
_PACMAN_AARCH64_CHROOT="pacman-aarch64-chroot-latest.tar.zst" export _KEYRING=" archlinuxarm"
_ARCHBOOT="archboot-arm"
_KEYRING=" archlinuxarm"
[[ -z "${1}" ]] && _usage [[ -z "${1}" ]] && _usage
_DIR="$1" _DIR="$1"
#shellcheck disable=SC2120 #shellcheck disable=SC2120
@ -14,7 +12,7 @@ _root_check
echo "Starting container creation ..." echo "Starting container creation ..."
echo "Create directory ${_DIR} ..." echo "Create directory ${_DIR} ..."
mkdir "${_DIR}" mkdir "${_DIR}"
if [[ "$(uname -m)" == "aarch64" ]]; then if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
_prepare_pacman _prepare_pacman
_install_base_packages _install_base_packages
_cleanmkinitcpio _cleanmkinitcpio
@ -29,18 +27,8 @@ if [[ "$(uname -m)" == "aarch64" ]]; then
_copy_mirrorlist_and_pacman_conf _copy_mirrorlist_and_pacman_conf
_change_pacman_conf _change_pacman_conf
fi fi
if [[ "$(uname -m)" == "x86_64" ]]; then if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then
echo "Downloading archlinuxarm pacman aarch64 chroot..." _aarch64_pacman_chroot
[[ -f pacman-aarch64-chroot-latest.tar.zst ]] || wget ${_PACMAN_AARCH64_CHROOT_SERVER}/${_PACMAN_AARCH64_CHROOT}{,.sig} >/dev/null 2>&1
# verify dowload
sleep 1
gpg --verify "${_PACMAN_AARCH64_CHROOT}.sig" >/dev/null 2>&1 || exit 1
bsdtar -C "${_DIR}" -xf "${_PACMAN_AARCH64_CHROOT}"
echo "Removing installation tarball ..."
rm ${_PACMAN_AARCH64_CHROOT}{,.sig}
# update container to latest packages
echo "Update container to latest packages..."
systemd-nspawn -D "${_DIR}" pacman -Syu --noconfirm >/dev/null 2>&1
_install_base_packages _install_base_packages
_cleanmkinitcpio _cleanmkinitcpio
_cleancache _cleancache
@ -52,3 +40,5 @@ if [[ "$(uname -m)" == "x86_64" ]]; then
fi fi
_set_hostname _set_hostname
echo "Finished container setup in ${_DIR} ." echo "Finished container setup in ${_DIR} ."
unset _ARCHBOOT
unset _KEYRING

View file

@ -2,7 +2,7 @@
# created by Tobias Powalowski <tpowa@archlinux.org> # created by Tobias Powalowski <tpowa@archlinux.org>
source /usr/lib/archboot/functions source /usr/lib/archboot/functions
source /usr/lib/archboot/release_functions source /usr/lib/archboot/release_functions
_ARCHBOOT="archboot-arm" export _ARCHBOOT="archboot-arm"
[[ -z "${1}" ]] && _usage [[ -z "${1}" ]] && _usage
_root_check _root_check
_aarch64_check _aarch64_check
@ -12,3 +12,4 @@ _create_boot
_create_torrent _create_torrent
_create_cksum _create_cksum
echo "Finished release creation in ${1} ." echo "Finished release creation in ${1} ."
unset _ARCHBOOT

View file

@ -1,9 +1,9 @@
#! /bin/bash #! /bin/bash
source /usr/lib/archboot/functions source /usr/lib/archboot/functions
source /usr/lib/archboot/server_functions source /usr/lib/archboot/server_functions
_ARCH="aarch64" export _ARCH="aarch64"
_root_check _root_check
_buildserver_check _buildserver_check
_update_aarch64_pacman_chroot _update_aarch64_pacman_chroot
_server_release _server_release
unset _ARCH

View file

@ -2,8 +2,8 @@
# created by Tobias Powalowski <tpowa@archlinux.org> # created by Tobias Powalowski <tpowa@archlinux.org>
source /usr/lib/archboot/functions source /usr/lib/archboot/functions
source /usr/lib/archboot/container_functions source /usr/lib/archboot/container_functions
_ARCHBOOT="archboot" export _ARCHBOOT="archboot"
_KEYRING="archlinux" export _KEYRING="archlinux"
[[ -z "${1}" ]] && _usage [[ -z "${1}" ]] && _usage
_DIR="$1" _DIR="$1"
#shellcheck disable=SC2120 #shellcheck disable=SC2120
@ -34,3 +34,5 @@ if grep -q "^\[testing" /etc/pacman.conf; then
fi fi
_set_hostname _set_hostname
echo "Finished container setup in ${_DIR} ." echo "Finished container setup in ${_DIR} ."
unset _ARCHBOOT
unset _KEYRING

View file

@ -2,10 +2,8 @@
# created by Tobias Powalowski <tpowa@archlinux.org> # created by Tobias Powalowski <tpowa@archlinux.org>
source /usr/lib/archboot/functions source /usr/lib/archboot/functions
source /usr/lib/archboot/release_functions source /usr/lib/archboot/release_functions
_ARCHBOOT="archboot" export _ARCHBOOT="archboot"
[[ -z "${1}" ]] && _usage [[ -z "${1}" ]] && _usage
_root_check _root_check
_x86_64_check _x86_64_check
echo "Start release creation in $1 ..." echo "Start release creation in $1 ..."
@ -14,3 +12,4 @@ _create_boot
_create_torrent _create_torrent
_create_cksum _create_cksum
echo "Finished release creation in ${1} ." echo "Finished release creation in ${1} ."
unset _ARCHBOOT

View file

@ -1,11 +1,11 @@
#! /bin/bash #! /bin/bash
source /usr/lib/archboot/functions source /usr/lib/archboot/functions
source /usr/lib/archboot/server_functions source /usr/lib/archboot/server_functions
_ARCH="x86_64" export _ARCH="x86_64"
_root_check _root_check
_buildserver_check _buildserver_check
_pacman_x86_64_use_default _pacman_x86_64_use_default
_server_release _server_release
_pacman_x86_64_restore _pacman_x86_64_restore
unset _ARCH

View file

@ -4,6 +4,8 @@ _CLEANUP_CACHE=""
_CLEANUP_CONTAINER="" _CLEANUP_CONTAINER=""
_LINUX_FIRMWARE="linux-firmware" _LINUX_FIRMWARE="linux-firmware"
_DIR="" _DIR=""
_PACMAN_AARCH64_CHROOT_SERVER="https://pkgbuild.com/~tpowa/archboot-helper/pacman-chroot-aarch64"
_PACMAN_AARCH64_CHROOT="pacman-aarch64-chroot-latest.tar.zst"
_usage () { _usage () {
echo "CREATE ARCHBOOT CONTAINER" echo "CREATE ARCHBOOT CONTAINER"
@ -34,6 +36,20 @@ _cleancache() {
fi fi
} }
_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
# verify dowload
sleep 1
gpg --verify "${_PACMAN_AARCH64_CHROOT}.sig" >/dev/null 2>&1 || exit 1
bsdtar -C "${_DIR}" -xf "${_PACMAN_AARCH64_CHROOT}"
echo "Removing installation tarball ..."
rm ${_PACMAN_AARCH64_CHROOT}{,.sig}
# update container to latest packages
echo "Update container to latest packages..."
systemd-nspawn -D "${_DIR}" pacman -Syu --noconfirm >/dev/null 2>&1
}
# clean container from not needed files # clean container from not needed files
_cleancontainer() { _cleancontainer() {
if [[ "${_CLEANUP_CONTAINER}" == "1" ]]; then if [[ "${_CLEANUP_CONTAINER}" == "1" ]]; then

View file

@ -56,7 +56,7 @@ _update_aarch64_pacman_chroot() {
_server_release() { _server_release() {
# create release in "${_ISOHOME}" # create release in "${_ISOHOME}"
cd "${_ISOHOME}" || exit 1 cd "${_ISOHOME}" || exit 1
"archboot-${_ARCH}-release.sh" "${_BUILDDIR}" || rm -r "${_BUILDDIR}" "archboot-${_ARCH}-release.sh" "${_BUILDDIR}" || (rm -r "${_BUILDDIR}"; exit 1)
# set user rights on files # set user rights on files
[[ -d "${_BUILDDIR}" ]] || exit 1 [[ -d "${_BUILDDIR}" ]] || exit 1
chmod 755 "${_BUILDDIR}" chmod 755 "${_BUILDDIR}"