mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-25 17:10:26 +00:00
Merge pull request #1510 from RaspAP/feat/installer-update
Add --provider non-interactive option to installer
This commit is contained in:
commit
4dd409211d
2 changed files with 57 additions and 39 deletions
|
@ -419,6 +419,8 @@ function _prompt_install_vpn_providers() {
|
|||
else
|
||||
_install_provider
|
||||
fi
|
||||
elif [[ "$pv_option" =~ ^[0-9]+$ ]]; then
|
||||
_install_provider
|
||||
else
|
||||
echo "(Skipped)"
|
||||
fi
|
||||
|
@ -426,13 +428,22 @@ function _prompt_install_vpn_providers() {
|
|||
|
||||
# Install VPN provider client configuration
|
||||
function _install_provider() {
|
||||
echo -e "Select an option from the list:"
|
||||
while true; do
|
||||
|
||||
json="$webroot_dir/config/"vpn-providers.json
|
||||
while IFS='|' read -r key value; do
|
||||
options["$key"]="$value"
|
||||
done< <(jq -r '.providers[] | "\(.id)|\(.name)|\(.bin_path)"' "$json")
|
||||
|
||||
if [ -n "$pv_option" ]; then
|
||||
if [[ -n ${options[$pv_option]+abc} ]]; then
|
||||
answer="$pv_option"
|
||||
else
|
||||
echo "Invalid choice. The specified option does not exist."
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
echo -e "Select an option from the list:"
|
||||
while true; do
|
||||
# display provider options
|
||||
for key in "${!options[@]}"; do
|
||||
echo " $key) ${options[$key]%%|*}"
|
||||
|
@ -445,6 +456,13 @@ function _install_provider() {
|
|||
_install_status 0 "(Skipped)"
|
||||
break
|
||||
elif [[ "$answer" =~ ^[0-9]+$ ]] && [[ -n ${options[$answer]+abc} ]]; then
|
||||
break
|
||||
else
|
||||
echo "Invalid choice. Select a valid option:"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
selected="${options[$answer]}"
|
||||
echo "Configuring support for ${selected%%|*}"
|
||||
bin_path=${selected#*|}
|
||||
|
@ -464,11 +482,6 @@ function _install_provider() {
|
|||
fi
|
||||
|
||||
_install_status 0
|
||||
break
|
||||
else
|
||||
echo "Invalid choice. Select a valid option:"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Prompt to install openvpn
|
||||
|
|
|
@ -42,6 +42,7 @@ OPTIONS:
|
|||
-o, --openvpn <flag> Used with -y, --yes, sets OpenVPN install option (0=no install)
|
||||
-a, --adblock <flag> Used with -y, --yes, sets Adblock install option (0=no install)
|
||||
-w, --wireguard <flag> Used with -y, --yes, sets WireGuard install option (0=no install)
|
||||
-e, --provider <value> Used with -y, --yes, sets the VPN provider install option
|
||||
-r, --repo, --repository <name> Overrides the default GitHub repo (RaspAP/raspap-webgui)
|
||||
-b, --branch <name> Overrides the default git branch (latest release)
|
||||
-t, --token <accesstoken> Specify a GitHub token to access a private repository
|
||||
|
@ -118,6 +119,10 @@ function _parse_params() {
|
|||
wg_option="$2"
|
||||
shift
|
||||
;;
|
||||
-e|--provider)
|
||||
pv_option="$2"
|
||||
shift
|
||||
;;
|
||||
-c|--cert|--certificate)
|
||||
install_cert=1
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue