Remember, if admin accepted OnlyOffice licence

This commit is contained in:
Wolfgang Ginolas 2024-03-06 09:48:49 +01:00 committed by wginolas
parent 49ad62c461
commit ead0dbe77f
2 changed files with 36 additions and 0 deletions

1
.gitignore vendored
View File

@ -36,3 +36,4 @@ www/common/onlyoffice/v*
/www/common/onlyoffice/dist/
/install-onlyoffice-docker.key
/onlyoffice-dist/
/onlyoffice.properties

View File

@ -5,11 +5,17 @@ set -euo pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
BUILDS_DIR=$SCRIPT_DIR/onlyoffice-builds.git
OO_DIR=$SCRIPT_DIR/www/common/onlyoffice/dist
PROPS_FILE="$SCRIPT_DIR"/onlyoffice.properties
declare -A props
main () {
load_props
parse_arguments "$@"
validate_arguments
ask_for_license
mkdir -p "$OO_DIR"
install_version v1 4f370beb
install_version v2b d9da72fd
@ -27,6 +33,22 @@ main () {
fi
}
load_props () {
if [ -e "$PROPS_FILE" ]; then
while IFS='=' read -r key value; do
props["$key"]="$value"
done < "$PROPS_FILE"
fi
}
set_prop () {
props["$1"]="$2"
for i in "${!props[@]}"; do
echo "$i=${props[$i]}"
done > "$PROPS_FILE"
}
parse_arguments () {
while [[ $# -gt 0 ]]; do
case $1 in
@ -64,6 +86,19 @@ validate_arguments () {
fi
}
ask_for_license () {
if [ "${props[agree_license]:-no}" == yes ]; then
return
fi
less << EOF
License
EOF
read -rp "Do you acceppt the license? (Y/N): " confirm \
&& [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
set_prop "agree_license" yes
}
show_help () {
cat << EOF
install-onlyoffice installs or upgrades OnlyOffice.