From dcb1a97cc866f9e79d3bcf50f3693f13a330e9af Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Wed, 31 Jul 2019 19:38:28 -0500 Subject: [PATCH] Add ability to run a local upgrade without reboot --- rootfs/standard/usr/bin/mynode-local-upgrade | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/rootfs/standard/usr/bin/mynode-local-upgrade b/rootfs/standard/usr/bin/mynode-local-upgrade index 062a8800..a84f0db9 100755 --- a/rootfs/standard/usr/bin/mynode-local-upgrade +++ b/rootfs/standard/usr/bin/mynode-local-upgrade @@ -11,7 +11,7 @@ source /usr/share/mynode/mynode_config.sh # Prompt for IP echo "Make sure your PC is running 'make start_file_server'..." ip_address="error" -if [ "$#" -ne 1 ]; then +if [ "$#" -lt 1 ]; then echo -n "Dev PC IP Address: " read ip_address else @@ -32,8 +32,22 @@ cp -rf /tmp/rootfs/out/rootfs_${DEVICE_TYPE}/* / systemctl daemon-reload # Sleep and sync FS +echo "Syncing filesystem..." sleep 1 sync -# Reboot Device -reboot \ No newline at end of file +# Restart or reboot +if [ "$#" -ge 2 ]; then + # Restart service + if [ "$2" = "www" ]; then + echo "Restarting www service..." + systemctl restart www + else + # Service not found, reboot + echo "Service not found, rebooting device..." + reboot + fi +else + echo "Rebooting device..." + reboot +fi \ No newline at end of file