Used sequpgrade.sh to upgrade existing seqs

This commit is contained in:
2022-05-29 20:58:23 +02:00
parent 10ee4198f0
commit 6214493c18
57 changed files with 802 additions and 806 deletions

View File

@@ -13,14 +13,14 @@ osName=
distName=
RPI_BOOT_CONFIG="/boot/config.txt"
step_config() {
seq_config() {
# Shift away args
local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
# Set download url with specified CPU architecture
PIDOWNURL="https://downloads.raspberrypi.org/raspios_lite_${PIARCH}_latest"
if [ "$(which lsb_release)" == "" ] ; then
echoerr " [W] Cannot detect OS. Assuming Ubuntu"
warning -e "Cannot detect OS. Assuming Ubuntu"
osName="Ubuntu"
else
osName=$(lsb_release -is)
@@ -28,12 +28,12 @@ step_config() {
fi
if [ "$osName" == "" ] ; then
echoerr " [W] Error dedecting OS. Assuming Ubuntu"
warning -e "Error dedecting OS. Assuming Ubuntu"
osName="Ubuntu"
fi
echoseq " Detected OS: $osName $distName"
echoseq " Requested CPU Architecture: $PIARCH"
info " Detected OS: $osName $distName"
info " Requested CPU Architecture: $PIARCH"
return 0
}
@@ -80,14 +80,14 @@ step_1_info() {
echoinfoArgs "[OPTIONS] [SD CARD DEVICE] [HD DEVICE]"
echo "Download latest Raspberry Pi OS lite image $PIARCH"
if [ $CONTEXT_EXE -ne 0 ]; then
if contextExe; then
echoinfo "Download URL: $PIDOWNURL"
else
echoinfo " [OPTIONS]"
echoinfo " -a, --arch : armhf (default), arm64"
fi
}
step_1_alias() { ALIAS="setup"; }
step_1_alias() { echo "setup"; }
step_1() {
# Shift away args
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
@@ -115,9 +115,9 @@ step_2_info() {
echoinfoArgs "[OPTIONS] [SD CARD DEVICE]"
echo "Write Raspberry Pi OS image to SD card"
echoinfo "This operation will delete all data previously on the SD card!"
[ $CONTEXT_EXE -ne 0 ] && [ ! -z $1 ] && echoinfo " [SD CARD DEVICE]: $1"
contextExe && [ ! -z $1 ] && echoinfo " [SD CARD DEVICE]: $1"
}
step_2_alias() { ALIAS="writesd"; }
step_2_alias() { echo "writesd"; }
step_2() {
# Shift away args
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
@@ -151,7 +151,7 @@ step_2() {
SDROOT=""
# TODO ? automatic remount
echoerr " [W] Please remove SD now and plug it back in."
warning -e "Please remove SD now and plug it back in."
exe read -p " Press enter to contiue."
}
@@ -161,7 +161,7 @@ step_3_info() {
echoinfoArgs "[SD CARD DEVICE]"
echo "Prepare SD for first run"
if [ $CONTEXT_EXE -ne 0 ]; then
if contextExe; then
[ ! -z $1 ] && echoinfo " [SD CARD DEVICE]: $1"
fi
}
@@ -170,7 +170,7 @@ step_3() {
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
if [ -z $1 ] && [ ! -z $SDDEV ] ; then
if [ $QUIET -ne 0 ] ; then
if quiet ; then
answer="n"
else
exe lsblk -p "$SDDEV"
@@ -192,7 +192,7 @@ step_3() {
endReturn -o $? "SD card device not found"
if [ ! -w "$SDBOOT" ] ; then
echoerr " [E] SD card boot partion not writeable"
error -e "SD card boot partion not writeable"
return 1
fi
@@ -212,12 +212,12 @@ step_4_info() {
echoinfoArgs "[SD CARD DEVICE] [HD DEVICE]"
echo "Prepare SD card to boot from hard disk"
if [ $CONTEXT_EXE -ne 0 ]; then
if contextExe; then
[ ! -z $1 ] && echoinfo " [SD CARD DEVICE]: $1"
[ ! -z $2 ] && echoinfo " [HD DEVICE]: $2"
fi
}
step_4_alias() { ALIAS="hdboot"; }
step_4_alias() { echo "hdboot"; }
step_4() {
# Shift away args
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
@@ -264,7 +264,7 @@ step_4() {
echo " [I] Resize root partion of SD: ${SDROOT} "
step resizesd "$SDDEV"
if [ $? -ne 0 ] ; then
echoerr " [W] Something seems to have failed during resize"
warning -e "Something seems to have failed during resize"
else
# Disable init script to resize SD
echo -n " [I] remove \"init=\" part from $SDBOOT/cmdline.txt.sd"
@@ -284,7 +284,7 @@ step_5_info() {
echoinfoArgs "[SD CARD DEVICE] [HD DEVICE]"
echo "Prepare HD for boot (TODO)"
if [ $CONTEXT_EXE -ne 0 ]; then
if contextExe; then
[ ! -z $1 ] && echoinfo " [SD CARD DEVICE]: $1"
[ ! -z $2 ] && echoinfo " [HD DEVICE]: $2"
fi
@@ -294,7 +294,7 @@ step_5() {
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
#TODO
echoerr " [E] Not ready yet...TODO"
error -e "Not ready yet...TODO"
#return 1
read_sd_dev "$1"
endReturn -o $? "SD detection error $?"
@@ -355,7 +355,7 @@ read_sd_dev() {
fi
if [ ! -b "$SDDEV" ] ; then
echoerr " [I] $SDDEV not a block device"
info -e "$SDDEV not a block device"
SDDEV=
return 1
fi
@@ -423,17 +423,17 @@ read_hd_dev() {
}
step_20_info() { echo "Disable swap file and remove it"; }
step_20_alias() { ALIAS="disable_swap"; }
step_20_alias() { echo "disable_swap"; }
step_20() {
exe swapoff -a
exe systemctl disable dphys-swapfile
exe rm -rf "$rpiSwapFile"
echoerr " [W] Reboot to apply changes"
if [ $QUIET -eq 0 ] ; then
warning -e "Reboot to apply changes"
if interactive ; then
exe read -p " Reboot now ([n]/y)? " answer
case $answer in
[yY])
echoerr " [I] Rebooting now ..."
info -e "Rebooting now ..."
exe reboot
;;
*)
@@ -444,12 +444,12 @@ step_20() {
rpiSwapFile="/var/swap"
step_22_info() { echoinfoArgs "[SD CARD DEVICE]"; echo "Resize second SD card partition"; }
step_22_alias() { ALIAS="resizesd"; }
step_22_alias() { echo "resizesd"; }
step_22() {
shift
read_sd_dev "$1"
if [ -z $SDDEV ] || [ "$SDDEV" = "" ] || [ "$SDROOT" == "/" ] ; then
echoerr " [E] No SD found"
error -e "No SD found"
return 1
fi
echo " [I] Device to be resized: $SDROOTDEV"
@@ -477,7 +477,7 @@ step_24_info() {
echoinfo " [OPTION]"
echoinfo " -p : Turn off permanentely (/etc/rc.local)"
}
step_24_alias() { ALIAS="disable_powerled"; }
step_24_alias() { echo "disable_powerled"; }
step_24() {
exep "${ledOffCmd}"
if [ ! -z "$2" ] && [ "$2" == "-p" ] ; then
@@ -497,13 +497,13 @@ ledPowerBright="/sys/class/leds/led1/brightness"
ledOffCmd="sudo sh -c 'echo 0 > ${ledPowerBright}'"
step_26_info() { echo "Restart network without reboot"; }
step_26_alias() { ALIAS="netrestart"; }
step_26_alias() { echo "netrestart"; }
step_26() {
exep "sudo ip link set eth0 down && sudo ip link set eth0 up"
}
step_28_info() { echo "Disable bluetooth"; }
step_28_alias() { ALIAS="disable_bluetooth"; }
step_28_alias() { echo "disable_bluetooth"; }
step_28() {
checkBootConfig "$RPI_CONFIG_DTOVERLAY" "$RPI_CONF_DI_BLUETOOTH"
[ $? -eq 0 ] && endReturn -o 1 "Bluetooth already disabled"
@@ -520,26 +520,26 @@ step_29() {
exe systemctl disable bluealsa.service
exe systemctl disable bluetooth.service
echoseq " [I] Consider uninstalling bluetooth software:"
echoseq "apt purge --autoremove -y bluez"
echoseq
echoseq " [W] Reboot to make changes active"
info "Consider uninstalling bluetooth software:"
info "apt purge --autoremove -y bluez"
info
warning "Reboot to make changes active"
}
step_31_info() { echo "Disable Wifi"; }
step_31_alias() { ALIAS="disable_wifi"; }
step_31_alias() { echo "disable_wifi"; }
step_31() {
checkBootConfig "$RPI_CONFIG_DTOVERLAY" "$RPI_CONF_DI_WIFI"
[ $? -eq 0 ] && endReturn -o 1 "Wifi already disabled"
addConf -a "${RPI_CONFIG_DTOVERLAY}=$RPI_CONF_DI_WIFI" "$RPI_BOOT_CONFIG"
echoseq " [W] Reboot to make changes active"
warning "Reboot to make changes active"
}
step_33_info() { echo "Disable HDMI"; }
step_33_alias() { ALIAS="disable_hdmi"; }
step_33_alias() { echo "disable_hdmi"; }
step_33() {
checkBootConfig "$RPI_CONFIG_HDMI_BLANK" "$RPI_CONF_DI_HDMI"
[ $? -eq 0 ] && endReturn -o 1 "HDMI already disabled"
@@ -563,7 +563,7 @@ step_34() {
exep "echo \"${tvserviceOffCmd}\" >> $startScript"
exep "echo -e \"\nexit 0\" >> $startScript"
echoseq " [W] Reboot to make changes active"
warning "Reboot to make changes active"
}
tvserviceBin="/usr/bin/tvservice"
tvserviceOffCmd="${tvserviceBin} -o'"
@@ -577,9 +577,9 @@ checkBootConfig() {
return $?
}
step_100_alias() { ALIAS="notes"; }
step_100_alias() { echo "notes"; }
step_100() {
outColor green
color green
cat <<NOTES_EOF
# Initial configuration steps
@@ -614,5 +614,5 @@ step_100() {
NOTES_EOF
}
VERSION_SEQREV=15
readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh