From b86a989dd31069ac59017eaa88302886276582e6 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Wed, 6 Sep 2023 10:06:10 +0200 Subject: [PATCH] use CACHEDIR --- usr/lib/archboot/container.sh | 12 ++++++------ usr/lib/archboot/release.sh | 4 ++-- usr/lib/archboot/update/desktop.sh | 2 +- usr/lib/archboot/update/manage.sh | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/usr/lib/archboot/container.sh b/usr/lib/archboot/container.sh index 82151d240..70ffe06fc 100644 --- a/usr/lib/archboot/container.sh +++ b/usr/lib/archboot/container.sh @@ -201,12 +201,12 @@ _install_archboot() { } #_install_custom_grub() { -# [[ -e /var/cache/pacman/pkg/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst ]] && \ -# cp "/var/cache/pacman/pkg/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst" \ -# "${1}/var/cache/pacman/pkg/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst" -# [[ -e /var/cache/pacman/pkg/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst.sig ]] && \ -# cp "/var/cache/pacman/pkg/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst.sig" \ -# "${1}/var/cache/pacman/pkg/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst.sig" +# [[ -e "${_CACHEDIR}"/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst ]] && \ +# cp ""${_CACHEDIR}"/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst" \ +# "${1}"${_CACHEDIR}"/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst" +# [[ -e "${_CACHEDIR}"/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst.sig ]] && \ +# cp ""${_CACHEDIR}"/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst.sig" \ +# "${1}"${_CACHEDIR}"/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst.sig" #} _copy_mirrorlist_and_pacman_conf() { diff --git a/usr/lib/archboot/release.sh b/usr/lib/archboot/release.sh index 8a6a6daef..650245cee 100644 --- a/usr/lib/archboot/release.sh +++ b/usr/lib/archboot/release.sh @@ -47,8 +47,8 @@ _create_iso() { # generate local iso in container #if [[ "${_ARCH}" == "x86_64" ]]; then # echo "Adding custom grub..." - # ${_DLPROG} -O --output-dir "${_W_DIR}/var/cache/pacman/pkg "https://archboot.com/src/grub/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst" " - # ${_DLPROG} -O --output-dir "${_W_DIR}/var/cache/pacman/pkg "https://archboot.com/src/grub/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst.sig" + # ${_DLPROG} -O --output-dir "${_W_DIR}${_CACHEDIR} "https://archboot.com/src/grub/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst" " + # ${_DLPROG} -O --output-dir "${_W_DIR}${_CACHEDIR} "https://archboot.com/src/grub/grub-2:2.06.r533.g78bc9a9b2-1-x86_64.pkg.tar.zst.sig" #fi ${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;rm -rf /tmp/*;archboot-${_ARCH}-iso.sh -g -s \ -c=${_CONFIG_LOCAL} -i=${_ISONAME}-local-${_ARCH}" || exit 1 diff --git a/usr/lib/archboot/update/desktop.sh b/usr/lib/archboot/update/desktop.sh index 173046930..77b2dfbeb 100644 --- a/usr/lib/archboot/update/desktop.sh +++ b/usr/lib/archboot/update/desktop.sh @@ -12,7 +12,7 @@ _cleanup_cache() { # remove packages from cache #shellcheck disable=SC2013 for i in $(grep 'installed' /var/log/pacman.log | cut -d ' ' -f 4); do - rm -rf /var/cache/pacman/pkg/"${i}"-[0-9]* + rm -rf "${_CACHEDIR}/${i}"-[0-9]* done } diff --git a/usr/lib/archboot/update/manage.sh b/usr/lib/archboot/update/manage.sh index b8404883e..3dd3b03c2 100644 --- a/usr/lib/archboot/update/manage.sh +++ b/usr/lib/archboot/update/manage.sh @@ -26,7 +26,7 @@ _create_container() { # add the db too on reboot install -D -m644 "${_LOCAL_DB}" "${_W_DIR}""${_LOCAL_DB}" if [[ -n "${_L_INSTALL_COMPLETE}" ]]; then - "archboot-${_RUNNING_ARCH}-create-container.sh" "${_W_DIR}" -cc --install-source=file:///var/cache/pacman/pkg >"${_LOG}" 2>&1 || exit 1 + "archboot-${_RUNNING_ARCH}-create-container.sh" "${_W_DIR}" -cc --install-source=file://${_CACHEDIR} >"${_LOG}" 2>&1 || exit 1 fi # needed for checks cp "${_W_DIR}""${_LOCAL_DB}" "${_LOCAL_DB}" @@ -348,7 +348,7 @@ _new_image() { _progress "1" "Removing files from /..." _clean_archboot _clean_kernel_cache - [[ -d var/cache/pacman/pkg ]] && rm -f /var/cache/pacman/pkg/* + [[ -d "${_CACHEDIR}" ]] && rm -f "${_CACHEDIR}"/* mkdir /archboot cd /archboot || exit 1 _W_DIR="$(mktemp -u archboot-release.XXX)" @@ -358,7 +358,7 @@ _new_image() { _create_container & _progress_wait "2" "20" "Generating container in ${_W_DIR}..." "10" _progress "21" "Create archboot.db in ${_W_DIR}..." - _create_archboot_db "${_W_DIR}"/var/cache/pacman/pkg > "${_LOG}" + _create_archboot_db "${_W_DIR}${CACHEDIR}" > "${_LOG}" # riscv64 does not support kexec at the moment if ! [[ "${_RUNNING_ARCH}" == "riscv64" ]]; then # removing not working lvm2 from latest image @@ -367,7 +367,7 @@ _new_image() { # generate local iso in container, umount tmp it's a tmpfs and weird things could happen then : > "${_W_DIR}"/.archboot (${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;rm -rf /tmp/*; archboot-${_RUNNING_ARCH}-iso.sh -g -s -p=${_PRESET_LOCAL} \ - -i=${_ISONAME}-local-${_RUNNING_ARCH}" > "${_LOG}"; rm -rf "${_W_DIR}"/var/cache/pacman/pkg/*; rm "${_W_DIR}"/.archboot) & + -i=${_ISONAME}-local-${_RUNNING_ARCH}" > "${_LOG}"; rm -rf "${_W_DIR}${_CACHEDIR}"/*; rm "${_W_DIR}"/.archboot) & _ram_check _progress_wait "23" "55" "Generating local ISO..." "10" # generate latest iso in container