summarylogtreecommitdiffstats
path: root/update-eula
blob: 576f4cc0de4d22996099e9ad5ebd2bf18aa9ed89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# This script is meant to be used by the maintainers to keep the EULA up to
# date.  It can also be used as a pre-push hook to automate things:
#
#     ln -s -f ../../update-eula  .git/hooks/pre-push
#
TOS_URL="https://unity3d.com/legal/terms-of-service"
TOS_SW_URL="$TOS_URL/software"

# Refer users to the original EULA
cat > EULA <<EOF
*** This is only the Software section of Unity's Terms of Service
*** for the complete Terms Of Service refer to ($TOS_URL)

EOF

# Download updated EULA, convert to plain text
curl -s $TOS_SW_URL \
  | xmllint --html --xpath "//section[@id='content']" - 2> /dev/null \
  | elinks -dump \
  | sed '/Quick jump/,$d' \
  | sed -r ':loop; s/([^ ])  +([^ ])/\1 \2/g; t loop' \
  | sed '/Quick jump/,$d' >> EULA

# Check for changes (pre-push hook)
if [ -n "$(git diff EULA)" ]; then
  echo "EULA has changed."
  exit 1
fi