summaryrefslogtreecommitdiffstats
path: root/scripts/install-https
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/install-https')
-rwxr-xr-xscripts/install-https58
1 files changed, 46 insertions, 12 deletions
diff --git a/scripts/install-https b/scripts/install-https
index ad77a97..121fb0e 100755
--- a/scripts/install-https
+++ b/scripts/install-https
@@ -1,7 +1,8 @@
#!/bin/bash
-CERTFILE="/etc/lighttpd/server.pem"
-CHAINFILE="/etc/lighttpd/chain.pem"
+declare -rg CERTFILE="/etc/lighttpd/server.pem"
+declare -rg CHAINFILE="/etc/lighttpd/chain.pem"
+declare -rg REDIR_FLAG="/etc/lighttpd/redirect.flag"
op_disable ()
{
@@ -76,20 +77,53 @@ generate_dh ()
fi
}
-OP=$1
-shift
+setup_redirect ()
+{
+ if [ -n "$REDIR" ]; then
+ touch "$REDIR_FLAG"
+ else
+ rm -f -- "$REDIR_FLAG"
+ fi
+}
-case "$OP" in
- --random) op_random "$@" ;;
- --test) op_test "$@" ;;
- --import) op_import "$@" ;;
- --disable) op_disable ;;
+RE_ONLY=
+REDIR=
+while true; do
+ case "$1" in
+ --redirect-only)
+ RE_ONLY=tru
+ ;;
+ --redirect)
+ REDIR=truh
+ ;;
*)
- echo "Invalid operation: $1"
- exit 1
+ break
;;
-esac
+ esac
+ shift
+done
+
+setup_redirect
+
+if [ -z "$RE_ONLY" ]; then
+
+ OP=$1
+ shift
+
+ case "$OP" in
+ --random) op_random "$@" ;;
+ --test) op_test "$@" ;;
+ --import) op_import "$@" ;;
+ --disable) op_disable ;;
+ *)
+ echo "Invalid operation: $1"
+ exit 1
+ ;;
+ esac
+
+fi
+sleep .5
systemctl restart lighttpd
exit 0