From 5ef6fc24425a5156e1118c46435c2a4794b13eba Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Mon, 11 Apr 2022 21:58:31 -0500 Subject: [PATCH] Consolidate scripts folders for dynamic apps --- rootfs/standard/etc/systemd/system/bitcoin.service | 2 +- rootfs/standard/etc/systemd/system/btcrpcexplorer.service | 2 +- .../standard/etc/systemd/system/corsproxy_btcrpc.service | 2 +- rootfs/standard/etc/systemd/system/lnbits.service | 2 +- rootfs/standard/etc/systemd/system/lnd.service | 2 +- rootfs/standard/etc/systemd/system/mempool.service | 4 ++-- rootfs/standard/etc/systemd/system/rtl.service | 2 +- rootfs/standard/etc/systemd/system/specter.service | 2 +- rootfs/standard/etc/systemd/system/sphinxrelay.service | 2 +- rootfs/standard/etc/systemd/system/whirlpool.service | 2 +- rootfs/standard/usr/bin/mynode_docker_images.sh | 2 +- .../bin/{service_post => service_scripts}/post_bitcoin.sh | 0 .../bin/{service_post => service_scripts}/post_dojo.sh | 0 .../bin/{service_post => service_scripts}/post_mempool.sh | 0 .../pre_btcrpcexplorer.sh | 0 .../bin/{service_pre => service_scripts}/pre_corsproxy.sh | 0 .../bin/{service_pre => service_scripts}/pre_lnbits.sh | 0 .../usr/bin/{service_pre => service_scripts}/pre_lnd.sh | 0 .../bin/{service_pre => service_scripts}/pre_mempool.sh | 0 .../usr/bin/{service_pre => service_scripts}/pre_rtl.sh | 0 .../bin/{service_pre => service_scripts}/pre_specter.sh | 0 .../{service_pre => service_scripts}/pre_sphinxrelay.sh | 0 .../bin/{service_pre => service_scripts}/pre_whirlpool.sh | 0 rootfs/standard/usr/share/mynode_apps/lndg/lndg.service | 4 ++-- rootfs/standard/var/pynode/application_info.py | 8 ++++---- 25 files changed, 18 insertions(+), 18 deletions(-) rename rootfs/standard/usr/bin/{service_post => service_scripts}/post_bitcoin.sh (100%) rename rootfs/standard/usr/bin/{service_post => service_scripts}/post_dojo.sh (100%) rename rootfs/standard/usr/bin/{service_post => service_scripts}/post_mempool.sh (100%) rename rootfs/standard/usr/bin/{service_pre => service_scripts}/pre_btcrpcexplorer.sh (100%) rename rootfs/standard/usr/bin/{service_pre => service_scripts}/pre_corsproxy.sh (100%) rename rootfs/standard/usr/bin/{service_pre => service_scripts}/pre_lnbits.sh (100%) rename rootfs/standard/usr/bin/{service_pre => service_scripts}/pre_lnd.sh (100%) rename rootfs/standard/usr/bin/{service_pre => service_scripts}/pre_mempool.sh (100%) rename rootfs/standard/usr/bin/{service_pre => service_scripts}/pre_rtl.sh (100%) rename rootfs/standard/usr/bin/{service_pre => service_scripts}/pre_specter.sh (100%) rename rootfs/standard/usr/bin/{service_pre => service_scripts}/pre_sphinxrelay.sh (100%) rename rootfs/standard/usr/bin/{service_pre => service_scripts}/pre_whirlpool.sh (100%) diff --git a/rootfs/standard/etc/systemd/system/bitcoin.service b/rootfs/standard/etc/systemd/system/bitcoin.service index 60142585..b92256e2 100644 --- a/rootfs/standard/etc/systemd/system/bitcoin.service +++ b/rootfs/standard/etc/systemd/system/bitcoin.service @@ -12,7 +12,7 @@ ExecStartPre=/bin/sh -c 'cat /mnt/hdd/mynode/quicksync/.quicksync_complete' ExecStartPre=+/usr/bin/mynode_gen_bitcoin_config.sh EnvironmentFile=/mnt/hdd/mynode/bitcoin/env ExecStart=/usr/local/bin/bitcoind -daemon $BTCARGS -deprecatedrpc=accounts -par=-1 -conf=/home/bitcoin/.bitcoin/bitcoin.conf -printtoconsole -pid=/home/bitcoin/.bitcoin/bitcoin.pid -ExecStartPost=+/usr/bin/service_post/post_bitcoin.sh +ExecStartPost=+/usr/bin/service_scripts/post_bitcoin.sh PIDFile=/home/bitcoin/.bitcoin/bitcoin.pid User=bitcoin Group=bitcoin diff --git a/rootfs/standard/etc/systemd/system/btcrpcexplorer.service b/rootfs/standard/etc/systemd/system/btcrpcexplorer.service index 44d91e06..18aaf7f9 100644 --- a/rootfs/standard/etc/systemd/system/btcrpcexplorer.service +++ b/rootfs/standard/etc/systemd/system/btcrpcexplorer.service @@ -10,7 +10,7 @@ After=bitcoin.service ExecStartPre=/usr/bin/is_not_shutting_down.sh ExecStartPre=/usr/bin/wait_on_bitcoin.sh ExecStartPre=/usr/bin/wait_on_electrs.sh -ExecStartPre=+/usr/bin/service_pre/pre_btcrpcexplorer.sh +ExecStartPre=+/usr/bin/service_scripts/pre_btcrpcexplorer.sh WorkingDirectory=/opt/mynode/btc-rpc-explorer ExecStart=/usr/bin/npm start diff --git a/rootfs/standard/etc/systemd/system/corsproxy_btcrpc.service b/rootfs/standard/etc/systemd/system/corsproxy_btcrpc.service index 75db01a0..cc6b2df6 100644 --- a/rootfs/standard/etc/systemd/system/corsproxy_btcrpc.service +++ b/rootfs/standard/etc/systemd/system/corsproxy_btcrpc.service @@ -9,7 +9,7 @@ After=bitcoin.service [Service] ExecStartPre=/usr/bin/is_not_shutting_down.sh ExecStartPre=/usr/bin/wait_on_bitcoin.sh -ExecStartPre=/usr/bin/service_pre/pre_corsproxy.sh +ExecStartPre=/usr/bin/service_scripts/pre_corsproxy.sh WorkingDirectory=/opt/mynode/corsproxy Environment="CORSPROXY_PORT=8335" "CORSPROXY_HOST=0.0.0.0" "CORSPROXY_TARGET=localhost:8332" "CORSPROXY_USE_HTTPS=true" "CORSPROXY_HTTPS_KEY=/home/bitcoin/.mynode/https/myNode.local.key" "CORSPROXY_HTTPS_CERT=/home/bitcoin/.mynode/https/myNode.local.crt" ExecStart=/usr/bin/npm start diff --git a/rootfs/standard/etc/systemd/system/lnbits.service b/rootfs/standard/etc/systemd/system/lnbits.service index 4f640904..2a743204 100644 --- a/rootfs/standard/etc/systemd/system/lnbits.service +++ b/rootfs/standard/etc/systemd/system/lnbits.service @@ -10,7 +10,7 @@ After=bitcoin.service lnd.service ExecStartPre=/usr/bin/is_not_shutting_down.sh ExecStartPre=/usr/bin/is_mainnet.sh ExecStartPre=/usr/bin/wait_on_lnd.sh -ExecStartPre=/usr/bin/service_pre/pre_lnbits.sh +ExecStartPre=/usr/bin/service_scripts/pre_lnbits.sh #ExecStartPre=/bin/sh -c 'cd /opt/mynode/lnbits && /usr/local/bin/pipenv run flask migrate' ExecStartPre=/bin/sh -c 'cd /opt/mynode/lnbits && ./lnbits_venv/bin/quart migrate' diff --git a/rootfs/standard/etc/systemd/system/lnd.service b/rootfs/standard/etc/systemd/system/lnd.service index 00eb9daa..b0fe5864 100644 --- a/rootfs/standard/etc/systemd/system/lnd.service +++ b/rootfs/standard/etc/systemd/system/lnd.service @@ -8,7 +8,7 @@ After=bitcoin.service [Service] ExecStartPre=/usr/bin/is_not_shutting_down.sh -ExecStartPre=/usr/bin/service_pre/pre_lnd.sh +ExecStartPre=/usr/bin/service_scripts/pre_lnd.sh ExecStartPre=/usr/bin/wait_on_bitcoin.sh ExecStartPre=+/usr/bin/mynode_gen_lnd_config.sh ExecStart=/usr/local/bin/lnd diff --git a/rootfs/standard/etc/systemd/system/mempool.service b/rootfs/standard/etc/systemd/system/mempool.service index b653ad9c..e2a95a7c 100644 --- a/rootfs/standard/etc/systemd/system/mempool.service +++ b/rootfs/standard/etc/systemd/system/mempool.service @@ -12,9 +12,9 @@ EnvironmentFile=/mnt/hdd/mynode/settings/.btcrpc_environment ExecStartPre=/usr/bin/is_not_shutting_down.sh ExecStartPre=/usr/bin/wait_on_bitcoin.sh ExecStartPre=/usr/bin/wait_on_docker_image_install.sh -ExecStartPre=/usr/bin/service_pre/pre_mempool.sh +ExecStartPre=/usr/bin/service_scripts/pre_mempool.sh ExecStart=/usr/local/bin/docker-compose up -ExecStartPost=/usr/bin/service_post/post_mempool.sh +ExecStartPost=/usr/bin/service_scripts/post_mempool.sh ExecStop=/usr/local/bin/docker-compose down diff --git a/rootfs/standard/etc/systemd/system/rtl.service b/rootfs/standard/etc/systemd/system/rtl.service index 1921cc51..1c923704 100644 --- a/rootfs/standard/etc/systemd/system/rtl.service +++ b/rootfs/standard/etc/systemd/system/rtl.service @@ -9,7 +9,7 @@ After=bitcoin.service [Service] ExecStartPre=/usr/bin/is_not_shutting_down.sh ExecStartPre=/usr/bin/wait_on_lnd.sh -ExecStartPre=+/usr/bin/service_pre/pre_rtl.sh +ExecStartPre=+/usr/bin/service_scripts/pre_rtl.sh WorkingDirectory=/opt/mynode/RTL ExecStart=/usr/bin/node rtl diff --git a/rootfs/standard/etc/systemd/system/specter.service b/rootfs/standard/etc/systemd/system/specter.service index e3a40744..1b872c22 100644 --- a/rootfs/standard/etc/systemd/system/specter.service +++ b/rootfs/standard/etc/systemd/system/specter.service @@ -9,7 +9,7 @@ After=bitcoin.service [Service] ExecStartPre=/usr/bin/is_not_shutting_down.sh ExecStartPre=/usr/bin/mynode_gen_cert.sh specter 825 -ExecStartPre=/usr/bin/service_pre/pre_specter.sh +ExecStartPre=/usr/bin/service_scripts/pre_specter.sh WorkingDirectory=/opt/mynode/specter Environment="SPECTER_API_ACTIVE=True" diff --git a/rootfs/standard/etc/systemd/system/sphinxrelay.service b/rootfs/standard/etc/systemd/system/sphinxrelay.service index ba2c40b3..48b8ba2d 100644 --- a/rootfs/standard/etc/systemd/system/sphinxrelay.service +++ b/rootfs/standard/etc/systemd/system/sphinxrelay.service @@ -9,7 +9,7 @@ After=lnd.service [Service] ExecStartPre=/usr/bin/is_not_shutting_down.sh ExecStartPre=/usr/bin/wait_on_lnd.sh -ExecStartPre=+/usr/bin/service_pre/pre_sphinxrelay.sh +ExecStartPre=+/usr/bin/service_scripts/pre_sphinxrelay.sh WorkingDirectory=/opt/mynode/sphinxrelay ExecStart=npm run prod diff --git a/rootfs/standard/etc/systemd/system/whirlpool.service b/rootfs/standard/etc/systemd/system/whirlpool.service index 2380fd9c..c03a2bec 100644 --- a/rootfs/standard/etc/systemd/system/whirlpool.service +++ b/rootfs/standard/etc/systemd/system/whirlpool.service @@ -7,7 +7,7 @@ WorkingDirectory=/mnt/hdd/mynode/whirlpool ExecStartPre=/usr/bin/is_not_shutting_down.sh ExecStartPre=/usr/bin/is_mainnet.sh ExecStartPre=/usr/bin/wait_on_bitcoin.sh -ExecStartPre=/usr/bin/service_pre/pre_whirlpool.sh +ExecStartPre=/usr/bin/service_scripts/pre_whirlpool.sh ExecStart=/usr/bin/java -jar /opt/mynode/whirlpool/whirlpool.jar --server=mainnet --resync --tor --auto-mix --mixs-target=3 --listen User=bitcoin Group=bitcoin diff --git a/rootfs/standard/usr/bin/mynode_docker_images.sh b/rootfs/standard/usr/bin/mynode_docker_images.sh index a43f0c2c..91b0a665 100755 --- a/rootfs/standard/usr/bin/mynode_docker_images.sh +++ b/rootfs/standard/usr/bin/mynode_docker_images.sh @@ -198,7 +198,7 @@ while true; do fi #Check for install/upgrade to finish to initialize Dojo mysql db - sudo /usr/bin/service_post/post_dojo.sh + sudo /usr/bin/service_scripts/post_dojo.sh # Wait for install script to finish wait $INSTALL_PID || MARK_DOJO_COMPLETE=0 diff --git a/rootfs/standard/usr/bin/service_post/post_bitcoin.sh b/rootfs/standard/usr/bin/service_scripts/post_bitcoin.sh similarity index 100% rename from rootfs/standard/usr/bin/service_post/post_bitcoin.sh rename to rootfs/standard/usr/bin/service_scripts/post_bitcoin.sh diff --git a/rootfs/standard/usr/bin/service_post/post_dojo.sh b/rootfs/standard/usr/bin/service_scripts/post_dojo.sh similarity index 100% rename from rootfs/standard/usr/bin/service_post/post_dojo.sh rename to rootfs/standard/usr/bin/service_scripts/post_dojo.sh diff --git a/rootfs/standard/usr/bin/service_post/post_mempool.sh b/rootfs/standard/usr/bin/service_scripts/post_mempool.sh similarity index 100% rename from rootfs/standard/usr/bin/service_post/post_mempool.sh rename to rootfs/standard/usr/bin/service_scripts/post_mempool.sh diff --git a/rootfs/standard/usr/bin/service_pre/pre_btcrpcexplorer.sh b/rootfs/standard/usr/bin/service_scripts/pre_btcrpcexplorer.sh similarity index 100% rename from rootfs/standard/usr/bin/service_pre/pre_btcrpcexplorer.sh rename to rootfs/standard/usr/bin/service_scripts/pre_btcrpcexplorer.sh diff --git a/rootfs/standard/usr/bin/service_pre/pre_corsproxy.sh b/rootfs/standard/usr/bin/service_scripts/pre_corsproxy.sh similarity index 100% rename from rootfs/standard/usr/bin/service_pre/pre_corsproxy.sh rename to rootfs/standard/usr/bin/service_scripts/pre_corsproxy.sh diff --git a/rootfs/standard/usr/bin/service_pre/pre_lnbits.sh b/rootfs/standard/usr/bin/service_scripts/pre_lnbits.sh similarity index 100% rename from rootfs/standard/usr/bin/service_pre/pre_lnbits.sh rename to rootfs/standard/usr/bin/service_scripts/pre_lnbits.sh diff --git a/rootfs/standard/usr/bin/service_pre/pre_lnd.sh b/rootfs/standard/usr/bin/service_scripts/pre_lnd.sh similarity index 100% rename from rootfs/standard/usr/bin/service_pre/pre_lnd.sh rename to rootfs/standard/usr/bin/service_scripts/pre_lnd.sh diff --git a/rootfs/standard/usr/bin/service_pre/pre_mempool.sh b/rootfs/standard/usr/bin/service_scripts/pre_mempool.sh similarity index 100% rename from rootfs/standard/usr/bin/service_pre/pre_mempool.sh rename to rootfs/standard/usr/bin/service_scripts/pre_mempool.sh diff --git a/rootfs/standard/usr/bin/service_pre/pre_rtl.sh b/rootfs/standard/usr/bin/service_scripts/pre_rtl.sh similarity index 100% rename from rootfs/standard/usr/bin/service_pre/pre_rtl.sh rename to rootfs/standard/usr/bin/service_scripts/pre_rtl.sh diff --git a/rootfs/standard/usr/bin/service_pre/pre_specter.sh b/rootfs/standard/usr/bin/service_scripts/pre_specter.sh similarity index 100% rename from rootfs/standard/usr/bin/service_pre/pre_specter.sh rename to rootfs/standard/usr/bin/service_scripts/pre_specter.sh diff --git a/rootfs/standard/usr/bin/service_pre/pre_sphinxrelay.sh b/rootfs/standard/usr/bin/service_scripts/pre_sphinxrelay.sh similarity index 100% rename from rootfs/standard/usr/bin/service_pre/pre_sphinxrelay.sh rename to rootfs/standard/usr/bin/service_scripts/pre_sphinxrelay.sh diff --git a/rootfs/standard/usr/bin/service_pre/pre_whirlpool.sh b/rootfs/standard/usr/bin/service_scripts/pre_whirlpool.sh similarity index 100% rename from rootfs/standard/usr/bin/service_pre/pre_whirlpool.sh rename to rootfs/standard/usr/bin/service_scripts/pre_whirlpool.sh diff --git a/rootfs/standard/usr/share/mynode_apps/lndg/lndg.service b/rootfs/standard/usr/share/mynode_apps/lndg/lndg.service index 5ee0319a..6909657f 100644 --- a/rootfs/standard/usr/share/mynode_apps/lndg/lndg.service +++ b/rootfs/standard/usr/share/mynode_apps/lndg/lndg.service @@ -8,9 +8,9 @@ After=www.service docker_images.service [Service] ExecStartPre=/usr/bin/is_not_shutting_down.sh -ExecStartPre=/bin/bash -c 'if [ -f /usr/bin/service_pre/pre_lndg.sh ]; then /bin/bash /usr/bin/service_pre/pre_lndg.sh; fi' +ExecStartPre=/bin/bash -c 'if [ -f /usr/bin/service_scripts/pre_lndg.sh ]; then /bin/bash /usr/bin/service_scripts/pre_lndg.sh; fi' ExecStart=/usr/bin/docker run --rm --name webssh2 -p 2222:2222 -v /opt/mynode/webssh2/config.json:/usr/src/config.json webssh2 -ExecStartPost=/bin/bash -c 'if [ -f /usr/bin/service_post/post_lndg.sh ]; then /bin/bash /usr/bin/service_post/post_lndg.sh; fi' +ExecStartPost=/bin/bash -c 'if [ -f /usr/bin/service_scripts/post_lndg.sh ]; then /bin/bash /usr/bin/service_scripts/post_lndg.sh; fi' ExecStop=/usr/bin/docker stop -t 2 webssh2 # Need new user diff --git a/rootfs/standard/var/pynode/application_info.py b/rootfs/standard/var/pynode/application_info.py index acf00703..c83e20a8 100644 --- a/rootfs/standard/var/pynode/application_info.py +++ b/rootfs/standard/var/pynode/application_info.py @@ -461,13 +461,13 @@ def init_dynamic_app(app_info): os.system("cp -f {} {}".format(app_dir+"/app.service", "/etc/systemd/system/"+app_name+".service")) os.system("cp -f {} {}".format(app_dir+"/"+app_name+".png", "/var/www/mynode/static/images/app_icons/"+app_name+".png")) if (os.path.isfile(app_dir+"/scripts/pre_"+app_name+".sh")): - os.system("cp -f {} {}".format(app_dir+"/scripts/pre_"+app_name+".sh", "/usr/bin/service_post/pre_"+app_name+".sh")) + os.system("cp -f {} {}".format(app_dir+"/scripts/pre_"+app_name+".sh", "/usr/bin/service_scripts/pre_"+app_name+".sh")) if (os.path.isfile(app_dir+"/scripts/post_"+app_name+".sh")): - os.system("cp -f {} {}".format(app_dir+"/scripts/post_"+app_name+".sh", "/usr/bin/service_pre/post_"+app_name+".sh")) + os.system("cp -f {} {}".format(app_dir+"/scripts/post_"+app_name+".sh", "/usr/bin/service_scripts/post_"+app_name+".sh")) if (os.path.isfile(app_dir+"/scripts/install"+app_name+".sh")): - os.system("cp -f {} {}".format(app_dir+"/scripts/install_"+app_name+".sh", "/usr/bin/service_install/install_"+app_name+".sh")) + os.system("cp -f {} {}".format(app_dir+"/scripts/install_"+app_name+".sh", "/usr/bin/service_scripts/install_"+app_name+".sh")) if (os.path.isfile(app_dir+"/scripts/uninstall"+app_name+".sh")): - os.system("cp -f {} {}".format(app_dir+"/scripts/uninstall"+app_name+".sh", "/usr/bin/service_uninstall/uninstall_"+app_name+".sh")) + os.system("cp -f {} {}".format(app_dir+"/scripts/uninstall"+app_name+".sh", "/usr/bin/service_scripts/uninstall_"+app_name+".sh")) log_message(" TODO: Install data files")