From 307057c787d23384dce718b0851c21bfa13e5657 Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Mon, 15 Nov 2021 22:56:12 -0600 Subject: [PATCH] Save device arch and do some docker re-installs if arch changes --- .../standard/usr/bin/mynode_docker_images.sh | 25 +++++++++++++++++++ .../usr/share/mynode/mynode_config.sh | 1 + 2 files changed, 26 insertions(+) diff --git a/rootfs/standard/usr/bin/mynode_docker_images.sh b/rootfs/standard/usr/bin/mynode_docker_images.sh index f2ca98a1..a42a9bbd 100755 --- a/rootfs/standard/usr/bin/mynode_docker_images.sh +++ b/rootfs/standard/usr/bin/mynode_docker_images.sh @@ -20,6 +20,31 @@ while true; do echo "Checking for building new docker images..." touch /tmp/installing_docker_images + # Check if we happened to change architectures (move from 32-bit to 64-bit Raspi4 image) + CURRENT_ARCH=$(uname -m) + SAVED_ARCH="unknown" + if [ ! -f $DEVICE_ARCHITECTURE_FILE ]; then + echo $CURRENT_ARCH > $DEVICE_ARCHITECTURE_FILE + fi + if [ -f $DEVICE_ARCHITECTURE_FILE ]; then + SAVED_ARCH=$(cat $DEVICE_ARCHITECTURE_FILE) + fi + if [ "$CURRENT_ARCH" != "$SAVED_ARCH" ]; then + # Reset docker stuff + docker system prune --all --force + + # Remove containers known to cause problems if cached + docker rmi debian:buster-slim + + # Mark mempool and dojo for re-install + # Must reset version for Dojo or it will fully re-install and break rather than 'upgrade' + echo "reset" > $WEBSSH2_VERSION_FILE + echo "reset" > $NETDATA_VERSION_FILE + echo "reset" > $MEMPOOL_VERSION_FILE + echo "reset" > $DOJO_VERSION_FILE + fi + echo $CURRENT_ARCH > $DEVICE_ARCHITECTURE_FILE + # Pull images that don't need to be built # ??? diff --git a/rootfs/standard/usr/share/mynode/mynode_config.sh b/rootfs/standard/usr/share/mynode/mynode_config.sh index 6c1750a7..ae030f96 100644 --- a/rootfs/standard/usr/share/mynode/mynode_config.sh +++ b/rootfs/standard/usr/share/mynode/mynode_config.sh @@ -53,6 +53,7 @@ SERIAL_NUM=$(mynode-get-device-serial) # Set all default / standard bash config settings MYNODE_DIR=/mnt/hdd/mynode MYNODE_STATUS_FILE=/tmp/.mynode_status +DEVICE_ARCHITECTURE_FILE="/mnt/hdd/mynode/settings/.device_arch" VPN_BACKUP_DIR=/mnt/hdd/mynode/vpn QUICKSYNC_DIR=/mnt/hdd/mynode/quicksync QUICKSYNC_CONFIG_DIR=/mnt/hdd/mynode/.config/transmission