quick_quicklisp.sh.in 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. #! @BASH@
  2. # tinmop: an humble mastodon client
  3. # Copyright (C) 2020 cage
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program.
  14. # If not, see [[http://www.gnu.org/licenses/][http://www.gnu.org/licenses/]].
  15. QUICKLISP_INSTALL_DIR=$HOME/quicklisp/
  16. QUICKLISP_URL="https://beta.quicklisp.org/quicklisp.lisp"
  17. QUICKLISP_SIG_URL="https://beta.quicklisp.org/quicklisp.lisp.asc"
  18. QUICKLISP_KEY_URL="https://beta.quicklisp.org/release-key.txt"
  19. QUICKLISP="quicklisp.lisp"
  20. QUICKLISP_SIG="quicklisp.lisp.asc"
  21. QUICKLISP_KEY="release-key"
  22. QUICKLISP_SIGNATURE="D7A3 +489D +DEFE +32B7 +D0E7 +CC61 +3079 +65AB +028B +5FF7";
  23. LISP_SOURCE_REGISTRY_DIR="$HOME/.config/common-lisp/"
  24. LISP_SOURCE_REGISTRY_FILE="$LISP_SOURCE_REGISTRY_DIR/source-registry.conf"
  25. BOLD_TEXT="\033[1m"
  26. NORMAL_TEXT="\033[0m"
  27. VERIFY_OK_RES=2
  28. echo_bold () {
  29. echo -e "${BOLD_TEXT}${1}${NORMAL_TEXT}";
  30. }
  31. check_quicklisp () {
  32. if [ -d "$QUICKLISP_INSTALL_DIR" ]; then
  33. echo 0;
  34. else
  35. echo 1;
  36. fi
  37. }
  38. check_quicklisp_signature () {
  39. chk1_prog='BEGIN {res=0} /Good signature.*release@quicklisp.org/ {res++; print res}'
  40. chk2_prog="BEGIN {res=0} /${QUICKLISP_SIGNATURE}/ {res++; print res}"
  41. res1=$(LC_MESSAGES="C" @GPG@ --verify quicklisp.lisp.asc quicklisp.lisp 2> >(@AWK@ -- "${chk1_prog}"))
  42. res2=$(@GPG@ --verify quicklisp.lisp.asc quicklisp.lisp 2> >(@AWK@ -- "${chk2_prog}"))
  43. res=$(expr $res1 + $res2)
  44. echo -n "$res"
  45. }
  46. install_quicklisp () {
  47. echo_bold "Downloading quicklisp...";
  48. @CURL@ "$QUICKLISP_URL" > $QUICKLISP;
  49. @CURL@ "$QUICKLISP_SIG_URL" > $QUICKLISP_SIG;
  50. @CURL@ "$QUICKLISP_KEY_URL" > $QUICKLISP_KEY;
  51. echo_bold "Importing gpg key.";
  52. @GPG@ --import $QUICKLISP_KEY;
  53. echo_bold "Verifing key";
  54. signature_verified=$(check_quicklisp_signature);
  55. if [ "$signature_verified" -ne $VERIFY_OK_RES ]; then
  56. echo_bold "Key verification failed!"
  57. exit 1;
  58. else
  59. echo_bold "Key sucessfully verified.";
  60. @LISP_COMPILER@ --load $QUICKLISP \
  61. --eval "(quicklisp-quickstart:install)" \
  62. --eval "(ql:add-to-init-file)" \
  63. --eval "(sb-ext:quit)";
  64. @MKDIR_P@ $LISP_SOURCE_REGISTRY_DIR;
  65. PAR_PWD="${PWD%/*}";
  66. echo "(:source-registry" > $LISP_SOURCE_REGISTRY_FILE;
  67. echo " (:tree \"$PAR_PWD\")" >> $LISP_SOURCE_REGISTRY_FILE;
  68. echo ":inherit-configuration)" >> $LISP_SOURCE_REGISTRY_FILE;
  69. echo "quicklisp installed";
  70. fi
  71. }
  72. install_dependency () {
  73. # add here the lisp dependency
  74. # e.g.
  75. # @LISP_COMPILER@ \ <- note the '\'
  76. # --eval "(ql:quickload \"swank\")" \ <- note the '\'
  77. # --eval "(sb-ext:quit)"; <- keep this line as latest
  78. @LISP_COMPILER@ \
  79. --eval "(ql:quickload \"alexandria\")" \
  80. --eval "(ql:quickload \"cl-ppcre\")" \
  81. --eval "(ql:quickload \"tooter\")" \
  82. --eval "(ql:quickload \"croatoan\")" \
  83. --eval "(ql:quickload \"osicat\")" \
  84. --eval "(ql:quickload \"cl-spark\")" \
  85. --eval "(ql:quickload \"access\")" \
  86. --eval "(ql:quickload \"sqlite\")" \
  87. --eval "(ql:quickload \"sxql\")" \
  88. --eval "(ql:quickload \"sxql-composer\")" \
  89. --eval "(ql:quickload \"marshal\")" \
  90. --eval "(ql:quickload \"bordeaux-threads\")" \
  91. --eval "(ql:quickload \"log4cl\")" \
  92. --eval "(ql:quickload \"local-time\")" \
  93. --eval "(ql:quickload \"cl-colors2\")" \
  94. --eval "(ql:quickload \"cl-i18n\")" \
  95. --eval "(ql:quickload \"clunit2\")" \
  96. --eval "(ql:quickload \"esrap\")" \
  97. --eval "(ql:quickload \"ieee-floats\")" \
  98. --eval "(ql:quickload \"parse-number\")" \
  99. --eval "(ql:quickload \"cl-html5-parser\")" \
  100. --eval "(ql:quickload \"unix-opts\")" \
  101. --eval "(ql:quickload \"crypto-shortcuts\")" \
  102. --eval "(ql:quickload \"drakma\")" \
  103. --eval "(ql:quickload \"usocket\")" \
  104. --eval "(ql:quickload \"cffi\")" \
  105. --eval "(ql:quickload \"babel\")" \
  106. --eval "(ql:quickload \"percent-encoding\")" \
  107. --eval "(sb-ext:quit)";
  108. }
  109. quicklisp_installed_p=$(check_quicklisp);
  110. if [ $quicklisp_installed_p -eq 0 ]; then
  111. echo_bold "Quicklisp already installed; fetching libraries...";
  112. install_dependency;
  113. else
  114. install_quicklisp;
  115. install_dependency;
  116. fi
  117. echo_bold "Finished."