prepared install sh to run within webinstaller

This commit is contained in:
gyurix
2024-08-13 13:23:02 +02:00
parent 277be66c6e
commit 06b34d72db
2 changed files with 34 additions and 31 deletions

View File

@@ -257,7 +257,7 @@ execute_task() {
elif [ "$TASK_NAME" == "install" ]; then elif [ "$TASK_NAME" == "install" ]; then
# TODO - start install.sh # TODO - start install.sh
sh /scripts/install.sh "$B64_JSON" sh /scripts/install.sh "$B64_JSON" "$service-exec"
JSON_TARGET=$(echo '{ "DATE": "'$DATE'", "INSTALL_STATUS": 1 }' | jq -r . | base64 -w0); # TEST JSON_TARGET=$(echo '{ "DATE": "'$DATE'", "INSTALL_STATUS": 1 }' | jq -r . | base64 -w0); # TEST
#JSON_TARGET=$(echo '{ "DATE": "'$DATE'", "INSTALL_STATUS": "'$INSTALL_STATUS'", "INSTALLED_SERVICES": {'$SERVICES'} }' | jq -r . | base64 -w0); #JSON_TARGET=$(echo '{ "DATE": "'$DATE'", "INSTALL_STATUS": "'$INSTALL_STATUS'", "INSTALLED_SERVICES": {'$SERVICES'} }' | jq -r . | base64 -w0);

View File

@@ -1,4 +1,6 @@
#!/bin/bash #!/bin/sh
SERVICE_EXEC=$2
ask_envs() { ask_envs() {
echo "VPN proxy? (Y/n)"; echo "VPN proxy? (Y/n)";
@@ -278,55 +280,56 @@ else
fi; fi;
# test - alias doesn't work inside a function # # test - alias doesn't work inside a function
# must be outside of if # # must be outside of if
shopt -s expand_aliases # shopt -s expand_aliases
source $HOME/.bash_aliases # source $HOME/.bash_aliases
if [ "$INIT" == "true" ]; then if [ "$INIT" == "true" ]; then
INIT_SERVICE_PATH=/etc/user/config/services INIT_SERVICE_PATH=/etc/user/config/services
AUTO_START_SERVICES="/etc/system/data/";
type -a service-debian # type -a service-debian
service-debian core-dns start $SERVICE_EXEC core-dns start
echo "$INIT_SERVICE_PATH/core-dns.json" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/core-dns.json" >> $AUTO_START_SERVICES/.init_services
if [ "$CRON" == "yes" ]; then if [ "$CRON" == "yes" ]; then
service-debian cron start $SERVICE_EXEC cron start
echo "$INIT_SERVICE_PATH/cron.json" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/cron.json" >> $AUTO_START_SERVICES/.init_services
fi fi
if [ "$VPN_PROXY" == "yes" ]; then if [ "$VPN_PROXY" == "yes" ]; then
service-debian vpn-proxy start $SERVICE_EXEC vpn-proxy start
echo "$INIT_SERVICE_PATH/vpn-proxy.json" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/vpn-proxy.json" >> $AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/firewall-vpn-smarthost-loadbalancer" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/firewall-vpn-smarthost-loadbalancer" >> $AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/firewall-vpn-proxy-postrouting" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/firewall-vpn-proxy-postrouting" >> $AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/firewall-vpn-proxy-prerouting" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/firewall-vpn-proxy-prerouting" >> $AUTO_START_SERVICES/.init_services
fi fi
if [ "$SMARTHOST_PROXY" == "yes" ]; then if [ "$SMARTHOST_PROXY" == "yes" ]; then
service-debian smarthost-proxy start $SERVICE_EXEC smarthost-proxy start
service-debian smarthost-proxy-scheduler start $SERVICE_EXEC smarthost-proxy-scheduler start
service-debian local-proxy start $SERVICE_EXEC local-proxy start
echo "$INIT_SERVICE_PATH/smarthost-proxy.json" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/smarthost-proxy.json" >> $AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/firewall-smarthost-loadbalancer-dns.json" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/firewall-smarthost-loadbalancer-dns.json" >> $AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/firewall-letsencrypt.json" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/firewall-letsencrypt.json" >> $AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/firewall-smarthostloadbalancer-from-publicbackend.json" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/firewall-smarthostloadbalancer-from-publicbackend.json" >> $AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/firewall-smarthost-backend-dns.json" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/firewall-smarthost-backend-dns.json" >> $AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/firewall-smarthost-to-backend.json" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/firewall-smarthost-to-backend.json" >> $AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/smarthost-proxy-scheduler.json" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/smarthost-proxy-scheduler.json" >> $AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/local-proxy.json" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/local-proxy.json" >> $AUTO_START_SERVICES/.init_services
echo "Would you like to run local backend? (Y/n)"; echo "Would you like to run local backend? (Y/n)";
read -r ANSWER; read -r ANSWER;
if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ "$ANSWER" == "" ] ; then if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ "$ANSWER" == "" ] ; then
service-debian local-backend start $SERVICE_EXEC local-backend start
echo "$INIT_SERVICE_PATH/local-backend.json" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/local-backend.json" >> $AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/firewall-local-backend.json" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/firewall-local-backend.json" >> $AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/domain-local-backend.json" >> $PWD/.init_services echo "$INIT_SERVICE_PATH/domain-local-backend.json" >> $AUTO_START_SERVICES/.init_services
fi fi
fi fi