add PACMAN_LIB

This commit is contained in:
Tobias Powalowski 2023-09-06 11:44:56 +02:00
parent c2d12b8c71
commit 12023caf9e
5 changed files with 8 additions and 7 deletions

View file

@ -10,7 +10,7 @@ pacman -Sy
pacman -Q | cut -d ' ' -f1 >packages.txt pacman -Q | cut -d ' ' -f1 >packages.txt
#shellcheck disable=SC2013 #shellcheck disable=SC2013
for i in $(cat packages.txt); do for i in $(cat packages.txt); do
rm -r /var/lib/pacman/local/"${i}"-*-[0-9]* rm -r "${_PACMAN_LIB}"/local/"${i}"-*-[0-9]*
#shellcheck disable=SC2086 #shellcheck disable=SC2086
if pacman -Sdd ${i} --noconfirm 2>&1 >>log.txt; then if pacman -Sdd ${i} --noconfirm 2>&1 >>log.txt; then
echo "${i}" >> uninstalled.orig.txt echo "${i}" >> uninstalled.orig.txt

View file

@ -33,11 +33,11 @@ _usage() {
# returns: 1 on error # returns: 1 on error
_prepare_pacman() { _prepare_pacman() {
# Set up the necessary directories for pacman use # Set up the necessary directories for pacman use
if [[ ! -d "${_DESTDIR}/var/cache/pacman/pkg" ]]; then if [[ ! -d "${_DESTDIR}${_CACHEDIR}" ]]; then
mkdir -p "${_DESTDIR}/var/cache/pacman/pkg" mkdir -p "${_DESTDIR}${_CACHEDIR}"
fi fi
if [[ ! -d "${_DESTDIR}/var/lib/pacman" ]]; then if [[ ! -d "${_DESTDIR}${_PACMAN_LIB}" ]]; then
mkdir -p "${_DESTDIR}/var/lib/pacman" mkdir -p "${_DESTDIR}${_PACMAN_LIB}"
fi fi
# pacman-key process itself # pacman-key process itself
while pgrep -x pacman-key &>"${_NO_LOG}"; do while pgrep -x pacman-key &>"${_NO_LOG}"; do

View file

@ -26,6 +26,7 @@ else
fi fi
_PACMAN_MIRROR="/etc/pacman.d/mirrorlist" _PACMAN_MIRROR="/etc/pacman.d/mirrorlist"
_PACMAN_CONF="/etc/pacman.conf" _PACMAN_CONF="/etc/pacman.conf"
_PACMAN_LIB="/var/lib/pacman"
_CACHEDIR="/var/cache/pacman/pkg" _CACHEDIR="/var/cache/pacman/pkg"
_LOCAL_DB="${_CACHEDIR}/archboot.db" _LOCAL_DB="${_CACHEDIR}/archboot.db"
_FIX_PACKAGES="libelf libevent talloc gcc-libs glibc glib2 pcre2 nss terminus-font" _FIX_PACKAGES="libelf libevent talloc gcc-libs glibc glib2 pcre2 nss terminus-font"

View file

@ -19,7 +19,7 @@ _run_pacman(){
_chroot_mount _chroot_mount
# Set up the necessary directories for pacman use # Set up the necessary directories for pacman use
[[ ! -d "${_DESTDIR}${_CACHEDIR}" ]] && mkdir -p "${_DESTDIR}${_CACHEDIR}" [[ ! -d "${_DESTDIR}${_CACHEDIR}" ]] && mkdir -p "${_DESTDIR}${_CACHEDIR}"
[[ ! -d "${_DESTDIR}/var/lib/pacman" ]] && mkdir -p "${_DESTDIR}/var/lib/pacman" [[ ! -d "${_DESTDIR}${_PACMAN_LIB}" ]] && mkdir -p "${_DESTDIR}${_PACMAN_LIB}"
echo "Installing Packages..." >/tmp/pacman.log echo "Installing Packages..." >/tmp/pacman.log
: > /.archboot : > /.archboot
_pacman & _pacman &

View file

@ -50,7 +50,7 @@ _generate_keyring "${1}" || exit 1
_fix_network "${1}" _fix_network "${1}"
# update container to latest packages # update container to latest packages
echo "Installing pacman to container..." echo "Installing pacman to container..."
mkdir -p "${1}/${_PACMAN_ARCH}/var/lib/pacman" mkdir -p "${1}/${_PACMAN_ARCH}${_PACMAN_LIB}"
#shellcheck disable=SC2086 #shellcheck disable=SC2086
systemd-nspawn -D "${1}" pacman --root "/${_PACMAN_ARCH}" -Sy awk ${_KEYRING} --ignore systemd-resolvconf --noconfirm &>"${_NO_LOG}" systemd-nspawn -D "${1}" pacman --root "/${_PACMAN_ARCH}" -Sy awk ${_KEYRING} --ignore systemd-resolvconf --noconfirm &>"${_NO_LOG}"
_generate_keyring "${1}/${_PACMAN_ARCH}" || exit 1 _generate_keyring "${1}/${_PACMAN_ARCH}" || exit 1