nand-sata-install: different errors - different codes & debug help

This commit is contained in:
Anton-Latukha 2019-03-02 21:30:45 +02:00
parent b37f4e13c8
commit f2e183da34

View File

@ -74,7 +74,7 @@ mountopts[f2fs]='defaults,noatime,nodiratime,x-gvfs-hide 0 2'
create_armbian()
{
# create mount points, mount and clean
TempDir=$(mktemp -d /mnt/${0##*/}.XXXXXX || exit 1)
TempDir=$(mktemp -d /mnt/${0##*/}.XXXXXX || exit 2)
sync && mkdir -p "${TempDir}"/bootfs "${TempDir}"/rootfs
if [[ $eMMCFilesystemChoosen =~ ^(btrfs|f2fs)$ ]]; then
[[ -n $1 ]] && mount ${1::-1}"1" "${TempDir}"/bootfs
@ -108,7 +108,7 @@ create_armbian()
dialog --title "$title" --backtitle "$backtitle" --colors --infobox\
"\n\Z1Partition too small.\Zn Needed: $USAGE MB Avaliable: $DEST MB" 5 60
umount_device "$1"; umount_device "$2"
exit 1
exit 3
fi
if [[ $1 == *nand* ]]; then
@ -183,7 +183,7 @@ create_armbian()
else
# if rsync return error
echo "Error: could not copy rootfs files, exiting"
exit 1
exit 4
fi
else
sleep 0.5
@ -278,7 +278,7 @@ create_armbian()
[[ -f "${TempDir}"/bootfs/boot/boot.ini ]] && sed -e 's,^setenv rootdev.*$,setenv rootdev "'"$targetuuid"'",' -i "${TempDir}"/bootfs/boot/boot.ini
[[ -f "${TempDir}"/rootfs/boot/boot.ini ]] && sed -e 's,^setenv rootdev.*$,setenv rootdev "'"$targetuuid"'",' -i "${TempDir}"/rootfs/boot/boot.ini
fi
mkimage -C none -A arm -T script -d "${TempDir}"/bootfs/boot/boot.cmd "${TempDir}"/bootfs/boot/boot.scr >/dev/null 2>&1 || (echo 'Error while creating U-Boot loader image with mkimage' >&2 ; exit 1)
mkimage -C none -A arm -T script -d "${TempDir}"/bootfs/boot/boot.cmd "${TempDir}"/bootfs/boot/boot.scr >/dev/null 2>&1 || (echo 'Error while creating U-Boot loader image with mkimage' >&2 ; exit 5)
# fstab adj
if [[ "$1" != "$2" ]]; then
@ -303,7 +303,7 @@ create_armbian()
if [[ $(type -t write_uboot_platform) != function ]]; then
echo "Error: no u-boot package found, exiting"
exit 1
exit 6
fi
write_uboot_platform "$DIR" $emmccheck
@ -327,7 +327,7 @@ create_armbian()
sed -e 's,setenv rootfstype.*,setenv rootfstype '"$FilesystemChoosen"',' -i /boot/boot.cmd
sed -e 's,setenv rootfstype.*,setenv rootfstype '"$FilesystemChoosen"',' -i /boot/boot.ini
fi
[[ -f /boot/boot.cmd ]] && mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr >/dev/null 2>&1 || (echo 'Error while creating U-Boot loader image with mkimage' >&2 ; exit 1)
[[ -f /boot/boot.cmd ]] && mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr >/dev/null 2>&1 || (echo 'Error while creating U-Boot loader image with mkimage' >&2 ; exit 7)
mkdir -p "${TempDir}"/rootfs/media/mmc/boot
echo "${sduuid} /media/mmcboot ext4 ${mountopts[ext4]}" >> "${TempDir}"/rootfs/etc/fstab
echo "/media/mmcboot/boot /boot none bind 0 0" >> "${TempDir}"/rootfs/etc/fstab
@ -403,7 +403,7 @@ show_nand_warning()
#
format_nand()
{
[[ ! -e /dev/nand ]] && echo '/dev/nand does not exist' >&2 && exit 1
[[ ! -e /dev/nand ]] && echo '/dev/nand does not exist' >&2 && exit 8
show_nand_warning
@ -433,7 +433,7 @@ format_emmc()
FilesystemCmd=(dialog --title "Select filesystem type for eMMC $1" --backtitle "$backtitle" --menu "\n$infos" 10 60 16)
FilesystemChoices=$("${FilesystemCmd[@]}" "${FilesystemOptions[@]}" 2>&1 >/dev/tty)
[[ $? -ne 0 ]] && exit 1
[[ $? -ne 0 ]] && exit 9
eMMCFilesystemChoosen=${FilesystemOptions[(2*$FilesystemChoices)-1]}
# deletes all partitions on eMMC drive
@ -518,7 +518,7 @@ format_disk()
FilesystemCmd=(dialog --title "Select filesystem type for $1" --backtitle "$backtitle" --menu "\n$infos" 10 60 16)
FilesystemChoices=$("${FilesystemCmd[@]}" "${FilesystemOptions[@]}" 2>&1 >/dev/tty)
[[ $? -ne 0 ]] && exit 1
[[ $? -ne 0 ]] && exit 10
FilesystemChoosen=${FilesystemOptions[(2*$FilesystemChoices)-1]}
dialog --title "$title" --backtitle "$backtitle" --infobox "\nFormating $1 to $FilesystemChoosen ... please wait." 5 60
@ -544,7 +544,7 @@ check_partitions()
PartitionCmd=(dialog --title 'Select destination:' --backtitle "$backtitle" --menu "\n$infos" 10 60 16)
PartitionChoices=$("${PartitionCmd[@]}" "${PartitionOptions[@]}" 2>&1 >/dev/tty)
[[ $? -ne 0 ]] && exit 1
[[ $? -ne 0 ]] && exit 11
DISK_ROOT_PART=${PartitionOptions[(2*$PartitionChoices)-1]}
}
@ -566,7 +566,7 @@ check_nvme_target()
NVMeCmd=(dialog --title 'Select destination:' --backtitle "$backtitle" --menu "\n$infos" 10 60 16)
NVMeChoices=$("${NVMeCmd[@]}" "${NVMeOptions[@]}" 2>&1 >/dev/tty)
[[ $? -ne 0 ]] && exit 1
[[ $? -ne 0 ]] && exit 12
DISK_ROOT_PART=${NVMeOptions[(2*$NVMeChoices)-1]}
}
@ -589,7 +589,7 @@ update_bootscript()
show_warning()
{
dialog --title "$title" --backtitle "$backtitle" --cr-wrap --colors --yesno " \Z1$(toilet -f mono12 WARNING)\Zn\n$1" 17 74
[[ $? -ne 0 ]] && exit 1
[[ $? -ne 0 ]] && exit 13
}
# try to stop running services
@ -609,7 +609,7 @@ main()
# This tool must run under root
if [[ $EUID -ne 0 ]]; then
echo 'This tool must run as root. Exiting ...' >&2
exit 1
exit 14
fi
# Check if we run it from SD card
@ -620,7 +620,7 @@ main()
;;
*)
dialog --title "$title" --backtitle "$backtitle" --colors --infobox '\n\Z1This tool must run from SD-card! \Zn' 5 37
exit 1
exit 15
;;
esac
@ -654,7 +654,7 @@ main()
dialog --ok-label 'Cancel' --title ' Warning ' --backtitle "$backtitle" --colors --no-collapse --msgbox '\n\Z1There are no targets. Please check your drives.\Zn' 7 52
cmd=(dialog --title 'Choose an option:' --backtitle "$backtitle" --menu "\nCurrent root: $root_uuid \n \n" 14 60 7)
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
[[ $? -ne 0 ]] && exit 1
[[ $? -ne 0 ]] && exit 16
for choice in $choices
do