Armbian-install script fixes (#8654)

* armbian-install: set `rootfstype` when installing with MTD flash boot

* armbian-install: add check for btrfs-progs

* Ensure `rootfstype` is set in the MTD boot scenario

* Change exit code to 12 when the user denies installing btrfs-progs

* Check for `mkfs.btrfs` instead of `btrfs`

* run debian noninteractive

* Check for mkfs.btrfs even after running the apt-get commands
This commit is contained in:
JohnTheCoolingFan 2025-11-06 03:08:59 +03:00 committed by GitHub
parent 3e3d725da4
commit 908bbc2be8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -465,6 +465,8 @@ create_armbian()
if [[ $1 == *mtd* ]]; then
if [[ -f "${TempDir}"/rootfs/boot/armbianEnv.txt ]]; then
sed -e 's,rootdev=.*,rootdev='"$satauuid"',g' -i "${TempDir}"/rootfs/boot/armbianEnv.txt
sed -e 's,rootfstype=.*,rootfstype='$FilesystemChoosen',g' -i "${TempDir}"/rootfs/boot/armbianEnv.txt
grep -qE '^rootfstype=' "${TempDir}/rootfs/boot/armbianEnv.txt" || echo "rootfstype=$FilesystemChoosen" >> "${TempDir}/rootfs/boot/armbianEnv.txt"
fi
if [[ -f "${TempDir}"/rootfs/boot/extlinux/extlinux.conf ]]; then
sed -e 's,root='"$root_uuid"',root='"$satauuid"',g' -i "${TempDir}"/rootfs/boot/extlinux/extlinux.conf
@ -668,6 +670,26 @@ format_disk()
[[ $? -ne 0 ]] && exit 10
FilesystemChoosen=${FilesystemOptions[(2*$FilesystemChoices)-1]}
if [[ $FilesystemChoosen == *btrfs* ]] && ! command -v mkfs.btrfs; then
dialog --yes-label "Install" --no-label 'Deny' --title "$title" --backtitle "$backtitle" --yesno "\nThe btrfs-progs package is not installed.\n\nIt is required to format the root partition as btrfs. Install it now?" 10 75
if [[ $? -eq 0 ]]; then
dialog --title "$title" --backtitle "$backtitle" --infobox "\nInstalling btrfs-progs ... please wait." 5 60
DEBIAN_FRONTEND=noninteractive apt-get update -o 'Dpkg::Use-pTy=0' >> $logfile 2>&1 &&\
DEBIAN_FRONTEND=noninteractive apt-get install -y -o 'Dpkg::Use-pTy=0' btrfs-progs >> $logfile 2>&1
if [[ ! $? -eq 0 ]]; then
dialog --title "$title" --backtitle "$backtitle" --colors --infobox\
"\nFailed to install btrfs-progs\n\nThe log file has been written to $logfile" 5 60
exit 15
fi
fi
if ! command -v mkfs.btrfs; then
dialog --title "$title" --backtitle "$backtitle" --colors\
--infobox "\nmkfs.btrfs not found, cannot proceed" 5 60
exit 12
fi
fi
dialog --title "$title" --backtitle "$backtitle" --infobox "\nFormating $1 to $FilesystemChoosen ... please wait." 5 60
mkfs.${FilesystemChoosen} ${mkopts[$FilesystemChoosen]} "$1" >> $logfile 2>&1
}