mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +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
@ -419,6 +419,8 @@ function _prompt_install_vpn_providers() {
|
|||||||
else
|
else
|
||||||
_install_provider
|
_install_provider
|
||||||
fi
|
fi
|
||||||
|
elif [[ "$pv_option" =~ ^[0-9]+$ ]]; then
|
||||||
|
_install_provider
|
||||||
else
|
else
|
||||||
echo "(Skipped)"
|
echo "(Skipped)"
|
||||||
fi
|
fi
|
||||||
@ -426,13 +428,22 @@ function _prompt_install_vpn_providers() {
|
|||||||
|
|
||||||
# Install VPN provider client configuration
|
# Install VPN provider client configuration
|
||||||
function _install_provider() {
|
function _install_provider() {
|
||||||
echo -e "Select an option from the list:"
|
|
||||||
while true; do
|
|
||||||
json="$webroot_dir/config/"vpn-providers.json
|
json="$webroot_dir/config/"vpn-providers.json
|
||||||
while IFS='|' read -r key value; do
|
while IFS='|' read -r key value; do
|
||||||
options["$key"]="$value"
|
options["$key"]="$value"
|
||||||
done< <(jq -r '.providers[] | "\(.id)|\(.name)|\(.bin_path)"' "$json")
|
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
|
# display provider options
|
||||||
for key in "${!options[@]}"; do
|
for key in "${!options[@]}"; do
|
||||||
echo " $key) ${options[$key]%%|*}"
|
echo " $key) ${options[$key]%%|*}"
|
||||||
@ -445,6 +456,13 @@ function _install_provider() {
|
|||||||
_install_status 0 "(Skipped)"
|
_install_status 0 "(Skipped)"
|
||||||
break
|
break
|
||||||
elif [[ "$answer" =~ ^[0-9]+$ ]] && [[ -n ${options[$answer]+abc} ]]; then
|
elif [[ "$answer" =~ ^[0-9]+$ ]] && [[ -n ${options[$answer]+abc} ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "Invalid choice. Select a valid option:"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
selected="${options[$answer]}"
|
selected="${options[$answer]}"
|
||||||
echo "Configuring support for ${selected%%|*}"
|
echo "Configuring support for ${selected%%|*}"
|
||||||
bin_path=${selected#*|}
|
bin_path=${selected#*|}
|
||||||
@ -464,11 +482,6 @@ function _install_provider() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
_install_status 0
|
_install_status 0
|
||||||
break
|
|
||||||
else
|
|
||||||
echo "Invalid choice. Select a valid option:"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Prompt to install openvpn
|
# Prompt to install openvpn
|
||||||
|
@ -42,6 +42,7 @@ OPTIONS:
|
|||||||
-o, --openvpn <flag> Used with -y, --yes, sets OpenVPN install option (0=no install)
|
-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)
|
-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)
|
-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)
|
-r, --repo, --repository <name> Overrides the default GitHub repo (RaspAP/raspap-webgui)
|
||||||
-b, --branch <name> Overrides the default git branch (latest release)
|
-b, --branch <name> Overrides the default git branch (latest release)
|
||||||
-t, --token <accesstoken> Specify a GitHub token to access a private repository
|
-t, --token <accesstoken> Specify a GitHub token to access a private repository
|
||||||
@ -118,6 +119,10 @@ function _parse_params() {
|
|||||||
wg_option="$2"
|
wg_option="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-e|--provider)
|
||||||
|
pv_option="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-c|--cert|--certificate)
|
-c|--cert|--certificate)
|
||||||
install_cert=1
|
install_cert=1
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user