get-convert-licenses.sh 744 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. # SPDX-License-Identifier: GPL-3.0-or-later
  3. set -e
  4. function txt_to_rtf() {
  5. INPUT="$1"
  6. OUTPUT="$2"
  7. echo '{\rtf1\ansi\deff0 {\fonttbl {\f0 Times New Roman;}}' > "$OUTPUT"
  8. echo '\paperh15840 \paperw12240' >> "$OUTPUT"
  9. echo '\margl720 \margr720 \margt720 \margb720' >> "$OUTPUT"
  10. echo '\f0\fs24' >> "$OUTPUT"
  11. sed s/\$/'\\line'/ "$INPUT" | sed s/\\f/'\\page'/ >> "$OUTPUT"
  12. echo '}' >> "$OUTPUT"
  13. }
  14. function check_and_get_file() {
  15. if [ ! -f "$1" ]; then
  16. curl -o "tmp.txt" "$2"
  17. txt_to_rtf "tmp.txt" "$1"
  18. rm "tmp.txt"
  19. fi
  20. }
  21. check_and_get_file "gpl-3.0.rtf" "https://www.gnu.org/licenses/gpl-3.0.txt"
  22. check_and_get_file "ncul1.rtf" "https://app.netdata.cloud/LICENSE.txt"