update script

The changes ensures that only valid branches is used and sets the correct branch name based on the first argument provided.

The keyring setup has been enhanced to counter for errors thrown if the pacman.d folder and the mirrorlist file was not available. This ensures that keyring initialization executes without errors.
This commit is contained in:
Frede H 2025-01-13 18:43:10 +01:00
parent db6d15eb86
commit 1a8b3b02ef
No known key found for this signature in database
1 changed files with 19 additions and 7 deletions

View File

@ -18,9 +18,16 @@ export DIALOGRC="/etc/manjaro-arm-installer/dialogrc_gui"
fi fi
BRANCH="arm-stable" BRANCH="arm-stable"
if [[ -n $1 ]]; then if [[ -n "$1" ]]; then
BRANCH=$1 if [[ "$1" =~ "testing" ]]; then
BRANCH="arm-testing"
elif [[ "$1" =~ "unstable" ]]; then
BRANCH="arm-unstable"
else
BRANCH="arm-stable"
fi fi
fi
# clearing variables # clearing variables
DEVICE="" DEVICE=""
EDITION="" EDITION=""
@ -136,16 +143,22 @@ create_install() {
touch $TMPDIR/root/MANJARO-ARM-IMAGE-BUILD touch $TMPDIR/root/MANJARO-ARM-IMAGE-BUILD
# Make this symlink available, it's created by systemd on a running system # Make this symlink available, it's created by systemd on a running system
mkdir -p $TMPDIR/root/etc mkdir -p $TMPDIR/root/etc/pacman.d
ln -sf ../usr/lib/os-release $TMPDIR/root/etc/os-release ln -sf ../usr/lib/os-release $TMPDIR/root/etc/os-release
# ensure an empty mirrorlist is available - pacman 7 ?
touch $TMPDIR/root/etc/pacman.d/mirrorlist
info "Setting up keyrings..." info "Setting up keyrings..."
$NSPAWN $TMPDIR/root pacman-key --init 1> /dev/null 2>&1 $NSPAWN $TMPDIR/root pacman-key --init 1> /dev/null 2>&1
info "Waiting for pacman gnupg to settle..."
sleep 5
info "Populating pacman gnupg..."
$NSPAWN $TMPDIR/root pacman-key --populate archlinuxarm manjaro manjaro-arm 1> /dev/null 2>&1 $NSPAWN $TMPDIR/root pacman-key --populate archlinuxarm manjaro manjaro-arm 1> /dev/null 2>&1
info "Setting target branch ${BRANCH}..." info "Setting target branch ${BRANCH}..."
sed -i 's|^Branch.*|Branch = '${BRANCH}'|' $TMPDIR/root/etc/pacman-mirrors.conf sed -i 's|.*Branch.*|Branch = '${BRANCH}'|g' $TMPDIR/root/etc/pacman-mirrors.conf
info "Generating mirrorlist..." info "Generating mirrorlist..."
$NSPAWN $TMPDIR/root pacman-mirrors -f10 1> /dev/null 2>&1 $NSPAWN $TMPDIR/root pacman-mirrors -f10 1> /dev/null 2>&1
@ -154,8 +167,7 @@ create_install() {
mkdir -p $TMPDIR/pkg-cache mkdir -p $TMPDIR/pkg-cache
mount -o bind $TMPDIR/pkg-cache $TMPDIR/root/var/cache/pacman/pkg mount -o bind $TMPDIR/pkg-cache $TMPDIR/root/var/cache/pacman/pkg
# Install device and editions specific packages # Install device and editions specific packages
$NSPAWN $TMPDIR/root pacman -Syyu base manjaro-system manjaro-release systemd systemd-libs $PKG_SHARED $PKG_EDITION $PKG_DEVICE --noconfirm $NSPAWN $TMPDIR/root pacman -Syu base manjaro-system manjaro-release systemd systemd-libs $PKG_SHARED $PKG_EDITION $PKG_DEVICE --noconfirm
info "Enabling services..." info "Enabling services..."
# Enable services # Enable services