2022-02-18 19:06:09 +01:00
|
|
|
#!/bin/sh
|
2020-05-08 15:45:43 +02:00
|
|
|
|
|
|
|
# tinmop: an humble mastodon client
|
|
|
|
# Copyright (C) 2020 cage
|
|
|
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program.
|
|
|
|
# If not, see [[http://www.gnu.org/licenses/][http://www.gnu.org/licenses/]].
|
|
|
|
|
|
|
|
QUICKLISP_INSTALL_DIR=$HOME/quicklisp/
|
|
|
|
|
|
|
|
QUICKLISP_URL="https://beta.quicklisp.org/quicklisp.lisp"
|
|
|
|
QUICKLISP_SIG_URL="https://beta.quicklisp.org/quicklisp.lisp.asc"
|
|
|
|
QUICKLISP_KEY_URL="https://beta.quicklisp.org/release-key.txt"
|
|
|
|
|
|
|
|
QUICKLISP="quicklisp.lisp"
|
|
|
|
QUICKLISP_SIG="quicklisp.lisp.asc"
|
|
|
|
QUICKLISP_KEY="release-key"
|
|
|
|
|
2022-02-18 19:06:09 +01:00
|
|
|
QUICKLISP_SIGNATURE="D7A3 +489D +DEFE +32B7 +D0E7 +CC61 +3079 +65AB +028B +5FF7"
|
2020-05-08 15:45:43 +02:00
|
|
|
|
|
|
|
LISP_SOURCE_REGISTRY_DIR="$HOME/.config/common-lisp/"
|
|
|
|
|
|
|
|
LISP_SOURCE_REGISTRY_FILE="$LISP_SOURCE_REGISTRY_DIR/source-registry.conf"
|
|
|
|
|
|
|
|
VERIFY_OK_RES=2
|
|
|
|
|
2021-07-05 18:12:45 +02:00
|
|
|
CROATOAN_GIT_URL=https://github.com/McParen/croatoan.git
|
|
|
|
|
2022-02-18 19:06:09 +01:00
|
|
|
CROATOAN_DIR="$QUICKLISP_INSTALL_DIR"/local-projects/croatoan/
|
2021-07-05 18:12:45 +02:00
|
|
|
|
2023-11-11 20:25:51 +01:00
|
|
|
CROATOAN_COMMIT=ff5841ab29b781fb7fec4d38296190f327803893
|
2021-07-06 17:43:15 +02:00
|
|
|
|
2023-06-20 19:57:30 +02:00
|
|
|
CL_COLORS2_GIT_URL=https://codeberg.org/cage/cl-colors2.git
|
2023-05-25 15:44:07 +02:00
|
|
|
|
|
|
|
CL_COLORS2_DIR="$QUICKLISP_INSTALL_DIR"/local-projects/cl-colors2/
|
|
|
|
|
2023-06-20 19:57:30 +02:00
|
|
|
NODGUI_GIT_URL=https://codeberg.org/cage/nodgui.git
|
2023-05-25 15:44:07 +02:00
|
|
|
|
|
|
|
NODGUI_DIR="$QUICKLISP_INSTALL_DIR"/local-projects/nodgui/
|
|
|
|
|
2023-11-11 20:25:51 +01:00
|
|
|
TOOTER_GIT_URL="https://github.com/Shinmera/tooter.git"
|
|
|
|
|
|
|
|
TOOTER_DIR="$QUICKLISP_INSTALL_DIR"/local-projects/tooter/
|
|
|
|
|
|
|
|
|
2020-05-08 15:45:43 +02:00
|
|
|
echo_bold () {
|
2022-02-18 19:06:09 +01:00
|
|
|
printf "\033[1m%s\033[0m\n" "$1"
|
2020-05-08 15:45:43 +02:00
|
|
|
}
|
|
|
|
|
2023-05-25 15:44:07 +02:00
|
|
|
check_dir (){
|
|
|
|
if [ -d "$1" ]; then
|
2021-07-05 18:12:45 +02:00
|
|
|
echo 0;
|
|
|
|
else
|
|
|
|
echo 1;
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2023-05-25 15:44:07 +02:00
|
|
|
check_croatoan (){
|
|
|
|
check_dir "$CROATOAN_DIR"
|
|
|
|
}
|
|
|
|
|
2020-05-08 15:45:43 +02:00
|
|
|
check_quicklisp () {
|
2023-05-25 15:44:07 +02:00
|
|
|
check_dir "$QUICKLISP_INSTALL_DIR"
|
|
|
|
}
|
|
|
|
|
|
|
|
check_cl_colors2 () {
|
|
|
|
check_dir "$CL_COLORS2_DIR"
|
|
|
|
}
|
|
|
|
|
|
|
|
check_nodgui () {
|
|
|
|
check_dir "$NODGUI_DIR"
|
2020-05-08 15:45:43 +02:00
|
|
|
}
|
|
|
|
|
2023-11-11 20:25:51 +01:00
|
|
|
check_tooter () {
|
|
|
|
check_dir "$TOOTER_DIR"
|
|
|
|
}
|
|
|
|
|
2020-05-08 15:45:43 +02:00
|
|
|
check_quicklisp_signature () {
|
|
|
|
chk1_prog='BEGIN {res=0} /Good signature.*release@quicklisp.org/ {res++; print res}'
|
|
|
|
chk2_prog="BEGIN {res=0} /${QUICKLISP_SIGNATURE}/ {res++; print res}"
|
2022-02-18 23:09:17 +01:00
|
|
|
res1=$(LC_MESSAGES="C" @GPG@ --verify quicklisp.lisp.asc quicklisp.lisp 2>&1 | @AWK@ -- "${chk1_prog}")
|
|
|
|
res2=$(@GPG@ --verify quicklisp.lisp.asc quicklisp.lisp 2>&1 | @AWK@ -- "${chk2_prog}")
|
|
|
|
res=$((res1 + res2))
|
2022-02-18 19:06:09 +01:00
|
|
|
printf "%s" "$res"
|
2020-05-08 15:45:43 +02:00
|
|
|
}
|
|
|
|
|
2023-05-25 15:44:07 +02:00
|
|
|
QUICKLIST_INSTALL_FORM="(quicklisp-quickstart:install)"
|
|
|
|
|
|
|
|
if [ "$1" = "--proxy" ] ; then
|
|
|
|
QUICKLIST_INSTALL_FORM="(quicklisp-quickstart:install :proxy \"$2\")"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$2" = "--proxy" ] ; then
|
|
|
|
QUICKLIST_INSTALL_FORM="(quicklisp-quickstart:install :proxy \"$3\")"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2020-05-08 15:45:43 +02:00
|
|
|
install_quicklisp () {
|
2022-02-18 19:06:09 +01:00
|
|
|
echo_bold "Downloading quicklisp..."
|
|
|
|
@CURL@ "$QUICKLISP_URL" > $QUICKLISP
|
|
|
|
@CURL@ "$QUICKLISP_SIG_URL" > $QUICKLISP_SIG
|
|
|
|
@CURL@ "$QUICKLISP_KEY_URL" > $QUICKLISP_KEY
|
|
|
|
echo_bold "Importing gpg key."
|
|
|
|
@GPG@ --import $QUICKLISP_KEY
|
|
|
|
echo_bold "Verifing key"
|
|
|
|
signature_verified=$(check_quicklisp_signature)
|
2020-05-08 15:45:43 +02:00
|
|
|
if [ "$signature_verified" -ne $VERIFY_OK_RES ]; then
|
|
|
|
echo_bold "Key verification failed!"
|
2022-02-18 19:06:09 +01:00
|
|
|
exit 1
|
2020-05-08 15:45:43 +02:00
|
|
|
else
|
2022-02-18 19:06:09 +01:00
|
|
|
echo_bold "Key sucessfully verified."
|
2022-02-20 12:54:53 +01:00
|
|
|
if test "$1" = "" ; then
|
|
|
|
@LISP_COMPILER@ --load $QUICKLISP \
|
2023-05-25 15:44:07 +02:00
|
|
|
--eval "$QUICKLIST_INSTALL_FORM" \
|
2022-02-20 12:54:53 +01:00
|
|
|
--eval "(ql:add-to-init-file)" \
|
|
|
|
--eval "(sb-ext:quit)";
|
|
|
|
else
|
|
|
|
@LISP_COMPILER@ --load $QUICKLISP \
|
2023-05-25 15:44:07 +02:00
|
|
|
--eval "$QUICKLIST_INSTALL_FORM" \
|
2022-02-20 12:54:53 +01:00
|
|
|
--eval "(ql-util:without-prompting (ql:add-to-init-file))" \
|
|
|
|
--eval "(sb-ext:quit)";
|
|
|
|
fi
|
2022-02-20 13:06:32 +01:00
|
|
|
@MKDIR_P@ "$LISP_SOURCE_REGISTRY_DIR"
|
2022-02-20 12:21:33 +01:00
|
|
|
PAR_PWD=$(@DIRNAME@ "$PWD")
|
2022-02-20 13:06:32 +01:00
|
|
|
echo "(:source-registry" > "$LISP_SOURCE_REGISTRY_FILE"
|
|
|
|
echo " (:tree \"$PAR_PWD\")" >> "$LISP_SOURCE_REGISTRY_FILE"
|
|
|
|
echo ":inherit-configuration)" >> "$LISP_SOURCE_REGISTRY_FILE"
|
2022-02-18 19:06:09 +01:00
|
|
|
echo "quicklisp installed"
|
2020-05-08 15:45:43 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
install_dependency () {
|
2022-03-27 15:26:05 +02:00
|
|
|
sbcl_args=''
|
|
|
|
while read -r dep; do
|
|
|
|
sbcl_args="$sbcl_args --eval '(ql:quickload \"$dep\")'"
|
|
|
|
done < lisp-dependencies
|
|
|
|
sbcl_args="$sbcl_args --eval '(sb-ext:quit)'"
|
|
|
|
|
|
|
|
eval "@LISP_COMPILER@ $sbcl_args"
|
2020-05-08 15:45:43 +02:00
|
|
|
}
|
|
|
|
|
2021-07-05 18:12:45 +02:00
|
|
|
install_croatoan () {
|
|
|
|
installedp=$(check_croatoan);
|
2023-05-25 15:44:07 +02:00
|
|
|
if [ "$installedp" -eq 0 ]; then
|
2022-02-20 13:06:32 +01:00
|
|
|
cd "$CROATOAN_DIR" && @GIT@ pull
|
2021-07-05 18:12:45 +02:00
|
|
|
else
|
2023-05-25 15:44:07 +02:00
|
|
|
cd "$QUICKLISP_INSTALL_DIR"/local-projects/ && @GIT@ clone "$CROATOAN_GIT_URL"
|
2021-07-05 18:12:45 +02:00
|
|
|
fi
|
2021-07-06 17:43:15 +02:00
|
|
|
|
2022-02-20 13:06:32 +01:00
|
|
|
cd "$CROATOAN_DIR" && @GIT@ checkout "$CROATOAN_COMMIT"
|
2021-07-05 18:12:45 +02:00
|
|
|
}
|
|
|
|
|
2023-05-25 15:44:07 +02:00
|
|
|
install_from_git () {
|
|
|
|
cd "$QUICKLISP_INSTALL_DIR"/local-projects/ && @GIT@ clone "$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
install_cl_colors2 () {
|
|
|
|
installedp=$(check_cl_colors2);
|
|
|
|
if [ "$installedp" -eq 0 ]; then
|
|
|
|
cd "$CL_COLORS2_DIR" && @GIT@ pull
|
|
|
|
else
|
|
|
|
install_from_git $CL_COLORS2_GIT_URL
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
install_nodgui () {
|
|
|
|
installedp=$(check_nodgui);
|
|
|
|
if [ "$installedp" -eq 0 ]; then
|
|
|
|
cd "$NODGUI_DIR" && @GIT@ pull
|
|
|
|
else
|
|
|
|
install_from_git $NODGUI_GIT_URL
|
|
|
|
fi
|
2024-04-15 21:04:49 +02:00
|
|
|
@LISP_COMPILER@ --eval '(ql:quickload "nodgui")' --eval "(sb-ext:quit)";
|
2023-05-25 15:44:07 +02:00
|
|
|
}
|
2021-07-05 18:12:45 +02:00
|
|
|
|
2023-11-11 20:25:51 +01:00
|
|
|
install_tooter () {
|
|
|
|
installedp=$(check_tooter);
|
|
|
|
if [ "$installedp" -eq 0 ]; then
|
|
|
|
cd "$TOOTER_DIR" && @GIT@ pull
|
|
|
|
else
|
|
|
|
install_from_git $TOOTER_GIT_URL
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-02-18 19:06:09 +01:00
|
|
|
quicklisp_installed_p=$(check_quicklisp)
|
2020-05-08 15:45:43 +02:00
|
|
|
|
2023-05-25 15:44:07 +02:00
|
|
|
if [ "$quicklisp_installed_p" -eq 0 ]; then
|
2022-02-18 19:06:09 +01:00
|
|
|
echo_bold "Quicklisp already installed; fetching libraries..."
|
|
|
|
install_dependency
|
2020-05-08 15:45:43 +02:00
|
|
|
else
|
2022-02-20 12:54:53 +01:00
|
|
|
if test "$1" = "--do-not-prompt" ; then
|
|
|
|
install_quicklisp 1
|
|
|
|
else
|
|
|
|
install_quicklisp
|
|
|
|
fi
|
2022-02-18 19:06:09 +01:00
|
|
|
install_dependency
|
2020-05-08 15:45:43 +02:00
|
|
|
fi
|
|
|
|
|
2022-02-18 19:06:09 +01:00
|
|
|
echo_bold "installing croatoan from git repository..."
|
|
|
|
install_croatoan
|
2021-07-05 18:12:45 +02:00
|
|
|
|
2023-05-25 15:44:07 +02:00
|
|
|
echo_bold "installing cl-colors2 from git repository..."
|
|
|
|
install_cl_colors2
|
|
|
|
|
|
|
|
echo_bold "installing nodgui from git repository..."
|
|
|
|
install_nodgui
|
|
|
|
|
2023-11-11 20:25:51 +01:00
|
|
|
echo_bold "installing tooter from git repository..."
|
|
|
|
install_tooter
|
|
|
|
|
2022-02-18 19:06:09 +01:00
|
|
|
echo_bold "Finished."
|