refactoring changes from sequpgrade (endReturn, ...) and some modernizations

This commit is contained in:
2023-01-03 15:49:08 +01:00
parent 215135e8aa
commit 3c22d5729f
69 changed files with 553 additions and 654 deletions

View File

@@ -50,18 +50,18 @@ step_1() {
if [ ! -f "$downShaFile" ] ; then
exe wget -O "$downShaFile" "$downSha256"
endReturn -o $? "Error downloading $downShaFile"
endReturn "Error downloading $downShaFile"
fi
if [ ! -f "$toolDownFile" ] ; then
exe wget -O "$toolDownFile" "$toolDownUrl"
endReturn -o $? "Error downloading $downDownFile"
endReturn "Error downloading $downDownFile"
fi
info "Checking SHA256 checksum"
exe cd $(dirname "$toolDownFile")
exe sha256sum -c "$downShaFile" >>/dev/null
endReturn -o $? "SHA256 checksum error"
exe sha256sum -c "$downShaFile" >>/dev/null
endReturn "SHA256 checksum error"
}
step_2_info() { echo "Write image to device"; }
@@ -73,7 +73,7 @@ step_2() {
fi
read_sd_dev "$SDDEV"
# check if device was confirmed
endReturn -o $? "SD card device not found"
endReturn "SD card device not found"
info "Writing $(basename "$toolDownFile")"
exep "xzcat \"$toolDownFile\" | dd of=$SDDEV bs=64k oflag=dsync status=progress"
@@ -143,7 +143,7 @@ step_12() {
fi
exe sed -i "s/#[[:space:]]*\($localUsDefault\)/\1/" "$localesConfigLoc"
endReturn -o $? "Changing locales failed"
endReturn "Changing locales failed"
exe locale-gen
exe update-locale LANG=$localUs
info "Logout and login for changes to be active"
@@ -162,7 +162,7 @@ step_14() {
return 0
fi
exe hostnamectl set-hostname "$localHostname"
endReturn -o $? "Couldn't set hostname"
endReturn "Couldn't set hostname"
exe sed -i "s/^\(127\.0\.0\.1[[:space:]]*\)\(localhost.*\)/\1\2\n\1$localHostname/" "$hostsLoc"
}
hostsLoc="/etc/hosts"
@@ -255,7 +255,7 @@ read_sd_dev() {
SDROOTDEV=
SDBOOTPUUID=
SDROOTPUUID=
echo " [I] Available devices:"
info "Available devices:"
echo
exe lsblk -p
echo
@@ -270,7 +270,7 @@ read_sd_dev() {
if [[ "$SDDEV" =~ .*blk.* ]] ; then
partExt="p"
fi
fi
if [ -z $SDBOOT ] ; then
SDBOOT=$(findmnt -no TARGET "${SDDEV}${partExt}${SDBOOTPARTNO}")