install: Add --agree-to-terms-of-service flag.

This commit is contained in:
Mateusz Mandera
2025-02-13 16:42:18 +08:00
committed by Tim Abbott
parent 0362e53dbf
commit 0a45a289f2
2 changed files with 63 additions and 36 deletions

View File

@@ -119,6 +119,12 @@ of the failure, you can just rerun the script. For more information, see
notifications are not enabled, no data will be submitted, so this flag is notifications are not enabled, no data will be submitted, so this flag is
redundant. redundant.
- `--agree-to-terms-of-service`: If you're using the `--push-notifications` flag,
you can pass this additional flag to indicate that you have read and agree to
the [Terms of Service][terms].
This skips the Terms of Service prompt, allowing for running the installer
with `--push-notifications` in scripts without requiring user input.
- `--self-signed-cert`: With this option, the Zulip installer - `--self-signed-cert`: With this option, the Zulip installer
generates a self-signed SSL certificate for the server. This isn't generates a self-signed SSL certificate for the server. This isn't
suitable for production use, but may be convenient for testing. suitable for production use, but may be convenient for testing.

View File

@@ -70,6 +70,14 @@ Options:
If push notifications are not enabled, data won't be submitted, so If push notifications are not enabled, data won't be submitted, so
this flag is redundant. this flag is redundant.
--agree-to-terms-of-service
If you enable push notifications, you can pass this flag to indicate
that you have read and agree to the Zulip Terms of Service:
<https://zulip.com/policies/terms>.
This skips the Terms of Service prompt, allowing for running the installer
with --push-notifications in scripts without requiring user input.
EOF EOF
} }
@@ -87,7 +95,7 @@ EOF
# Shell option parsing. Over time, we'll want to move some of the # Shell option parsing. Over time, we'll want to move some of the
# environment variables below into this self-documenting system. # environment variables below into this self-documenting system.
args="$(getopt -o '' --long help,hostname:,email:,certbot,self-signed-cert,cacert:,postgresql-database-name:,postgresql-database-user:,postgresql-version:,postgresql-missing-dictionaries,no-init-db,puppet-classes:,no-overwrite-settings,no-dist-upgrade,push-notifications,no-push-notifications,no-submit-usage-statistics -n "$0" -- "$@")" args="$(getopt -o '' --long help,hostname:,email:,certbot,self-signed-cert,cacert:,postgresql-database-name:,postgresql-database-user:,postgresql-version:,postgresql-missing-dictionaries,no-init-db,puppet-classes:,no-overwrite-settings,no-dist-upgrade,push-notifications,no-push-notifications,no-submit-usage-statistics,agree-to-terms-of-service -n "$0" -- "$@")"
eval "set -- $args" eval "set -- $args"
while true; do while true; do
@@ -179,6 +187,10 @@ while true; do
NO_SUBMIT_USAGE_STATISTICS=1 NO_SUBMIT_USAGE_STATISTICS=1
shift shift
;; ;;
--agree-to-terms-of-service)
AGREE_TO_TERMS_OF_SERVICE_FLAG=1
shift
;;
--) --)
shift shift
break break
@@ -268,43 +280,52 @@ else
SERVICE_SUBMIT_USAGE_STATISTICS="False" SERVICE_SUBMIT_USAGE_STATISTICS="False"
fi fi
# If user asked for push notifications, prompt for ToS acceptance. # ToS acceptance needs to be ensured if --push-notifications is passed.
if [ -n "$PUSH_NOTIFICATIONS" ]; then if [ -n "$PUSH_NOTIFICATIONS" ]; then
echo # If the user provided the --agree-to-terms-of-service flag, we can just proceed.
echo "You chose to register your server for the Mobile Push Notifications Service." if [ -n "$AGREE_TO_TERMS_OF_SERVICE_FLAG" ]; then
echo "Doing so will share basic metadata with the service's maintainers, including:" PUSH_NOTIFICATIONS_SERVICE_TOS_AGREED=1
echo echo "Push notifications will be enabled, as you agreed to the Zulip Terms of Service"
echo "* The server's configured hostname: $EXTERNAL_HOST" echo "by passing the --agree-to-terms-of-service flag."
echo "* The server's configured contact email address: $ZULIP_ADMINISTRATOR" sleep 2
echo "* Basic metadata about each organization hosted by the server; see:" else
echo " <https://zulip.com/doc-permalinks/basic-metadata>" # If user asked for push notifications, prompt for ToS acceptance.
if [ -z "$NO_SUBMIT_USAGE_STATISTICS" ]; then echo
echo "* The server's usage statistics; see:" echo "You chose to register your server for the Mobile Push Notifications Service."
echo " <https://zulip.com/doc-permalinks/usage-statistics>" echo "Doing so will share basic metadata with the service's maintainers, including:"
fi echo
echo echo "* The server's configured hostname: $EXTERNAL_HOST"
echo "For details on why a centralized push notification service is necessary, see:" echo "* The server's configured contact email address: $ZULIP_ADMINISTRATOR"
echo " <https://zulip.com/doc-permalinks/why-service>" echo "* Basic metadata about each organization hosted by the server; see:"
echo echo " <https://zulip.com/doc-permalinks/basic-metadata>"
echo "Use of this service is governed by the Zulip Terms of Service:" if [ -z "$NO_SUBMIT_USAGE_STATISTICS" ]; then
echo " <https://zulip.com/policies/terms>" echo "* The server's usage statistics; see:"
echo echo " <https://zulip.com/doc-permalinks/usage-statistics>"
read -r -p "Do you want to agree to the Zulip Terms of Service and proceed? [Y/n] " tos_prompt fi
echo echo
echo "For details on why a centralized push notification service is necessary, see:"
echo " <https://zulip.com/doc-permalinks/why-service>"
echo
echo "Use of this service is governed by the Zulip Terms of Service:"
echo " <https://zulip.com/policies/terms>"
echo
read -r -p "Do you want to agree to the Zulip Terms of Service and proceed? [Y/n] " tos_prompt
echo
# Normalize the users response to lowercase. # Normalize the users response to lowercase.
case "${tos_prompt,,}" in case "${tos_prompt,,}" in
"" | y | yes) "" | y | yes)
echo "Great! Push notifications will be enabled; continuing with installation..." echo "Great! Push notifications will be enabled; continuing with installation..."
PUSH_NOTIFICATIONS_SERVICE_TOS_AGREED=1 PUSH_NOTIFICATIONS_SERVICE_TOS_AGREED=1
sleep 2 sleep 2
;; ;;
*) *)
echo "In order to enable push notifications, you must agree to the Terms of Service." echo "In order to enable push notifications, you must agree to the Terms of Service."
echo "If you do not want to enable push notifications, run the command without the --push-notifications flag." echo "If you do not want to enable push notifications, run the command without the --push-notifications flag."
exit 1 exit 1
;; ;;
esac esac
fi
fi fi
# Do set -x after option parsing is complete # Do set -x after option parsing is complete