From 37c81fcb54ba4f7f839bf3e8b45b6a1923dd43bd Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Wed, 23 Oct 2019 23:18:46 -0500 Subject: [PATCH] Default disable QS on SSDs --- rootfs/standard/usr/bin/mynode_quicksync.sh | 2 +- rootfs/standard/usr/bin/mynode_startup.sh | 21 +++++++++++++++++-- rootfs/standard/var/www/mynode/device_info.py | 5 +---- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/rootfs/standard/usr/bin/mynode_quicksync.sh b/rootfs/standard/usr/bin/mynode_quicksync.sh index 51aaa412..698f648e 100755 --- a/rootfs/standard/usr/bin/mynode_quicksync.sh +++ b/rootfs/standard/usr/bin/mynode_quicksync.sh @@ -19,7 +19,7 @@ cp -f /usr/share/quicksync/settings.json $QUICKSYNC_CONFIG_DIR/settings.json sleep 15s # Check if quicksync was disabled -while [ -f /home/bitcoin/.mynode/quicksync_disabled ] || [ -f /mnt/hdd/mynode/settings/quicksync_disabled ]; do +while [ -f /mnt/hdd/mynode/settings/quicksync_disabled ]; do # Pretend quicksync step is complete touch $QUICKSYNC_DIR/.quicksync_download_complete touch $QUICKSYNC_DIR/.quicksync_complete diff --git a/rootfs/standard/usr/bin/mynode_startup.sh b/rootfs/standard/usr/bin/mynode_startup.sh index 63d7c454..d25ecfd9 100755 --- a/rootfs/standard/usr/bin/mynode_startup.sh +++ b/rootfs/standard/usr/bin/mynode_startup.sh @@ -79,8 +79,6 @@ useradd -m -s /bin/bash pivpn || true # Regen SSH keys (check if force regen or keys are missing / empty) while [ ! -f /home/bitcoin/.mynode/.gensshkeys ] || - [ ! -f /mnt/hdd/mynode/settings/.btcrpcpw ] || - [ ! -s /mnt/hdd/mynode/settings/.btcrpcpw ] || [ ! -f /etc/ssh/ssh_host_ecdsa_key.pub ] || [ ! -s /etc/ssh/ssh_host_ecdsa_key.pub ] || [ ! -f /etc/ssh/ssh_host_ed25519_key.pub ] || @@ -94,6 +92,8 @@ do systemctl restart ssh touch /home/bitcoin/.mynode/.gensshkeys + sync + sleep 5s done # Sync product key (SD preferred) @@ -115,6 +115,23 @@ if [ ! -f /mnt/hdd/mynode/settings/.lndalias ]; then echo "mynodebtc.com [myNode]" > /mnt/hdd/mynode/settings/.lndalias fi +# Default QuickSync +if [ ! -f /mnt/hdd/mynode/settings/.setquicksyncdefault ]; then + rm -f /mnt/hdd/mynode/settings/quicksync_disabled + + # Default x86 to no QuickSync + if [ $IS_X86 = 1 ]; then + touch /mnt/hdd/mynode/settings/quicksync_disabled + fi + # Default SSD to no QuickSync + DRIVE=$(cat /tmp/.mynode_drive) + HDD=$(lsblk $DRIVE -o ROTA | tail -n 1 | tr -d '[:space:]') + if [ "$HDD" = "0" ]; then + touch /mnt/hdd/mynode/settings/quicksync_disabled + fi + touch /mnt/hdd/mynode/settings/.setquicksyncdefault +fi + # BTC Config cp -f /usr/share/mynode/bitcoin.conf /mnt/hdd/mynode/bitcoin/bitcoin.conf diff --git a/rootfs/standard/var/www/mynode/device_info.py b/rootfs/standard/var/www/mynode/device_info.py index 0e2cedbc..7c879f8b 100644 --- a/rootfs/standard/var/www/mynode/device_info.py +++ b/rootfs/standard/var/www/mynode/device_info.py @@ -63,13 +63,10 @@ def unset_uploader(): def is_quicksync_enabled(): - return not os.path.isfile("/home/bitcoin/.mynode/quicksync_disabled") and \ - not os.path.isfile("/mnt/hdd/mynode/settings/quicksync_disabled") + return not os.path.isfile("/mnt/hdd/mynode/settings/quicksync_disabled") def disable_quicksync(): - os.system("touch /home/bitcoin/.mynode/quicksync_disabled") os.system("touch /mnt/hdd/mynode/settings/quicksync_disabled") def enable_quicksync(): - os.system("rm -rf /home/bitcoin/.mynode/quicksync_disabled") os.system("rm -rf /mnt/hdd/mynode/settings/quicksync_disabled")