New seq for basic raspberry pi setup

WIP
This commit is contained in:
2019-12-23 06:29:17 +01:00
parent ebe2bee4fd
commit f90e95461e

57
seqs/raspberry.sh Executable file
View File

@@ -0,0 +1,57 @@
#!/bin/bash
# Collection of setup steps for a new raspberry pi
# (e.g. boot from HD, disable swap file, ...)
# Get script working directory
# (when called from a different directory)
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
#CONFIG_FILE="$WDIR/${toolName}.cfg"
#CONFIG_FILE_DEFAULT="${CONFIG_FILE}.example"
#step_config() {
# echo "Called once before executing steps."
# echo "e.g. to source a config file:"
# #. "$CONFIG_FILE"
#}
step_20_info() { echo "Disable swap file and remove it"; }
step_20_alias() { ALIAS="disableswap"; }
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
exe read -p " Reboot now ([n]/y)? " answer
case $answer in
[yY])
echoerr " [I] Rebooting now ..."
exe reboot
;;
*)
;;
esac
fi
}
rpiSwapFile="/var/swap"
step_22_info() { echo "Resize second SD card partition [MOUNTPOINT]"; }
step_22_alias() { ALIAS="resizesd"; }
step_22() {
local mountP="$resizeMount"
if [ ! -z $2 ] && [ "$2" != "" ] && [ "$2" != "/" ] ; then
mountP=$2
fi
exe umount -q "$mountP"
exe parted -s "$resizeDevice" "resizepart $resizePartNo -1" quit
exe resize2fs "$resizePart"
exe mount "$mountP"
}
resizeMount="/backup"
resizeDevice="/dev/mmcblk0"
resizePartNo=2
resizePart="${resizeDevice}p${resizePartNo}"
VERSION_SEQREV=8
. /usr/local/bin/sequencer.sh