Skip to content
12 changes: 12 additions & 0 deletions packages/bsp/common/usr/bin/armbian-install
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ 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
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
Expand Down Expand Up @@ -668,6 +669,17 @@ format_disk()
[[ $? -ne 0 ]] && exit 10
FilesystemChoosen=${FilesystemOptions[(2*$FilesystemChoices)-1]}

if [[ $FilesystemChoosen == *btrfs* ]] && ! command -v 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
apt update && apt install --yes btrfs-progs
else
dialog --title "$title" --backtitle "$backtitle" --colors --infobox\
"\nCannot proceed without btrfs-progs" 5 60
exit 10
fi
fi

dialog --title "$title" --backtitle "$backtitle" --infobox "\nFormating $1 to $FilesystemChoosen ... please wait." 5 60
mkfs.${FilesystemChoosen} ${mkopts[$FilesystemChoosen]} "$1" >> $logfile 2>&1
}
Expand Down