From 1a8b3b02efb8534946e00619a228925ce1870833 Mon Sep 17 00:00:00 2001 From: Frede H Date: Mon, 13 Jan 2025 18:43:10 +0100 Subject: [PATCH] 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. --- manjaro-arm-installer | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/manjaro-arm-installer b/manjaro-arm-installer index 389bd8b..64facc0 100755 --- a/manjaro-arm-installer +++ b/manjaro-arm-installer @@ -18,9 +18,16 @@ export DIALOGRC="/etc/manjaro-arm-installer/dialogrc_gui" fi BRANCH="arm-stable" -if [[ -n $1 ]]; then - BRANCH=$1 +if [[ -n "$1" ]]; then + if [[ "$1" =~ "testing" ]]; then + BRANCH="arm-testing" + elif [[ "$1" =~ "unstable" ]]; then + BRANCH="arm-unstable" + else + BRANCH="arm-stable" + fi fi + # clearing variables DEVICE="" EDITION="" @@ -136,16 +143,22 @@ create_install() { touch $TMPDIR/root/MANJARO-ARM-IMAGE-BUILD # 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 + # ensure an empty mirrorlist is available - pacman 7 ? + touch $TMPDIR/root/etc/pacman.d/mirrorlist - info "Setting up keyrings..." $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 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..." $NSPAWN $TMPDIR/root pacman-mirrors -f10 1> /dev/null 2>&1 @@ -154,8 +167,7 @@ create_install() { mkdir -p $TMPDIR/pkg-cache mount -o bind $TMPDIR/pkg-cache $TMPDIR/root/var/cache/pacman/pkg # 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..." # Enable services