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
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
generates a self-signed SSL certificate for the server. This isn't
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
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
}
@@ -87,7 +95,7 @@ EOF
# Shell option parsing. Over time, we'll want to move some of the
# 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"
while true; do
@@ -179,6 +187,10 @@ while true; do
NO_SUBMIT_USAGE_STATISTICS=1
shift
;;
--agree-to-terms-of-service)
AGREE_TO_TERMS_OF_SERVICE_FLAG=1
shift
;;
--)
shift
break
@@ -268,8 +280,16 @@ else
SERVICE_SUBMIT_USAGE_STATISTICS="False"
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 the user provided the --agree-to-terms-of-service flag, we can just proceed.
if [ -n "$AGREE_TO_TERMS_OF_SERVICE_FLAG" ]; then
PUSH_NOTIFICATIONS_SERVICE_TOS_AGREED=1
echo "Push notifications will be enabled, as you agreed to the Zulip Terms of Service"
echo "by passing the --agree-to-terms-of-service flag."
sleep 2
else
# If user asked for push notifications, prompt for ToS acceptance.
echo
echo "You chose to register your server for the Mobile Push Notifications Service."
echo "Doing so will share basic metadata with the service's maintainers, including:"
@@ -305,6 +325,7 @@ if [ -n "$PUSH_NOTIFICATIONS" ]; then
exit 1
;;
esac
fi
fi
# Do set -x after option parsing is complete