diff --git a/seqs/raspberry.sh b/seqs/raspberry.sh new file mode 100755 index 0000000..5fac193 --- /dev/null +++ b/seqs/raspberry.sh @@ -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