installer: tolerate skipped killswitch; create service regardless and only start if user confirmed; conditional enable/start in setup_services
This commit is contained in:
parent
69b9d03586
commit
8f2eece7cb
1 changed files with 27 additions and 9 deletions
36
install.sh
36
install.sh
|
@ -500,8 +500,11 @@ install_killswitch() {
|
||||||
echo ""
|
echo ""
|
||||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||||
warning "Killswitch installation skipped. System is NOT protected!"
|
warning "Killswitch installation skipped. System is NOT protected!"
|
||||||
warning "Run 'systemctl start vpn-killswitch' to activate later."
|
warning "You can enable it later with: systemctl start vpn-killswitch"
|
||||||
return
|
# Still install the service and script, but don't start it
|
||||||
|
SHOULD_START_KILLSWITCH="no"
|
||||||
|
else
|
||||||
|
SHOULD_START_KILLSWITCH="yes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create killswitch script
|
# Create killswitch script
|
||||||
|
@ -600,12 +603,15 @@ ExecStart=/usr/local/bin/vpn-killswitch.sh enable
|
||||||
WantedBy=sysinit.target
|
WantedBy=sysinit.target
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Enable and start killswitch
|
# Enable and (optionally) start killswitch
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable vpn-killswitch.service
|
systemctl enable vpn-killswitch.service || true
|
||||||
systemctl start vpn-killswitch.service
|
if [ "$SHOULD_START_KILLSWITCH" = "yes" ]; then
|
||||||
|
systemctl start vpn-killswitch.service || true
|
||||||
log "Killswitch installed and activated"
|
log "Killswitch installed and activated"
|
||||||
|
else
|
||||||
|
log "Killswitch installed but not started (per user choice)"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install Mullvad
|
# Install Mullvad
|
||||||
|
@ -1022,8 +1028,20 @@ EOFMON
|
||||||
|
|
||||||
# Reload and start services
|
# Reload and start services
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable vpn-killswitch vpn-webui vpn-security-monitor
|
|
||||||
systemctl start vpn-killswitch vpn-webui vpn-security-monitor
|
# Enable services conditionally (killswitch may be skipped earlier)
|
||||||
|
if [ -f /etc/systemd/system/vpn-killswitch.service ]; then
|
||||||
|
systemctl enable vpn-killswitch || true
|
||||||
|
else
|
||||||
|
warning "Killswitch service not installed or was skipped; skipping enable"
|
||||||
|
fi
|
||||||
|
systemctl enable vpn-webui vpn-security-monitor || true
|
||||||
|
|
||||||
|
# Start services conditionally
|
||||||
|
if [ -f /etc/systemd/system/vpn-killswitch.service ]; then
|
||||||
|
systemctl start vpn-killswitch || true
|
||||||
|
fi
|
||||||
|
systemctl start vpn-webui vpn-security-monitor || true
|
||||||
|
|
||||||
log "Services configured and started"
|
log "Services configured and started"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue