diff options
author | Shinmera | 2023-10-20 10:47:22 +0200 |
---|---|---|
committer | Shinmera | 2023-10-20 10:47:22 +0200 |
commit | 2053e2c9cc2babaf13134cb38b7d25932fc9564a (patch) | |
tree | d08632b0ce760c4f8d055a601718bc87c125185e | |
parent | f915f02cdb8e0696db4b6926f459fe28c56fc7f2 (diff) | |
download | aur-2053e2c9cc2babaf13134cb38b7d25932fc9564a.tar.gz |
Include the qlot installer to avoid breakage
-rw-r--r-- | PKGBUILD | 4 | ||||
-rw-r--r-- | installer | 103 |
2 files changed, 105 insertions, 2 deletions
@@ -13,13 +13,13 @@ makedepends=('sbcl' 'sdl2' 'ncurses') conflicts=('lem-editor') provides=('lem-editor') source=("lem::git+https://github.com/lem-project/lem" - "https://qlot.tech/installer" + "installer" "general.lisp" "build-ncurses.lisp" "build-sdl2.lisp" "lem.desktop") b2sums=('SKIP' - 'd44ed1885e334a340372dcfafaf6409b2bc10ea9537445cf7590d0c2ca0fd708279ed15e903c7f4a64bc175d8bccdc703177d0e31faf8e6fce6b4489311c19fc' + 'a235f8c3027b5656dba0666c87cb26a8980339aa3aaf62fe321392a200c3fd17776ca263d0e1ce975e3e3012f02064cf97a18b7e367acdf3dacb91c7f21cb5d1' 'c228c6d9b3eb8379b40be04c7caef16698996642405dcbe769cbf3e8a09ff4464d4ed5638ff2cb12346a77cdf2e1f5eee42d7eb13aeb8f80d2f37c458ab82a6f' 'c4302f39f5f916f5491f3816d95d60f93502eec4f2d3d8c75f69a464245ed252d89872d2997e907200bac15be39f064e6d69fe2213286dc60650f06fe28e1425' 'a56e3dd69583c68f4c4e9b3e04c0ab80becd5e8ef98a2fbc7a7fe4aa27a4a6f4f98ff8dd814b1efbe144fdf59e7456fe707bf23095345bb60b198672418aff51' diff --git a/installer b/installer new file mode 100644 index 000000000000..c96f1856c0a6 --- /dev/null +++ b/installer @@ -0,0 +1,103 @@ +#!/bin/bash + +VERSION=${VERSION:-heads/master} + +if [ `id -u` == "0" ]; then + QLOT_BASE=${QLOT_BASE:-/usr/local} + QLOT_HOME=${QLOT_HOME:-"$QLOT_BASE/lib/qlot"} + QLOT_SOURCE_DIR="$QLOT_HOME" + QLOT_LOGS_DIR=/tmp/qlot/logs + QLOT_BIN_DIR="$QLOT_BASE/bin" +else + QLOT_HOME=${QLOT_HOME:-~/.qlot} + QLOT_SOURCE_DIR=${QLOT_SOURCE_DIR:-"$QLOT_HOME/qlot"} + QLOT_LOGS_DIR="$QLOT_HOME/logs" + QLOT_BIN_DIR="$QLOT_HOME/bin" +fi + +errmsg() { echo -e "\e[31mError: $1\e[0m" >&2; } +notice() { echo -e "\e[33m$1\e[0m"; } +success() { echo -e "\e[32m$1\e[0m"; } + +check_requirement() { + cmd=$1 + if [ "$(which "$cmd" 2>/dev/null)" == "" ]; then + errmsg "$cmd is required to install Qlot" + exit 1 + fi +} + +if [ "$(which sbcl 2>/dev/null)" != "" ]; then + lisp="sbcl" +elif [ "$(which ros 2>/dev/null)" != "" ]; then + lisp="ros without-roswell=t -L sbcl-bin run --" +else + errmsg "sbcl is required to setup Qlot." + exit 1 +fi + +qlot_version() { + $lisp --noinform --no-sysinit --no-userinit --non-interactive \ + --eval '(require :asdf)' --eval "(asdf:load-asd \"$QLOT_SOURCE_DIR/qlot.asd\")" \ + --eval '(progn (princ (asdf:component-version (asdf:find-system :qlot))) (fresh-line))' +} + +check_requirement "curl" +check_requirement "tar" + +success 'Welcome to Qlot automatic installer!' +echo '' +echo "Installation path: $QLOT_HOME" + +archive="https://github.com/fukamachi/qlot/archive/refs/$VERSION.tar.gz" + +if [ -f "$QLOT_SOURCE_DIR/qlot.asd" ]; then + rm -rf "$QLOT_SOURCE_DIR/" +fi + +mkdir -p "$QLOT_HOME" +mkdir -p "$QLOT_SOURCE_DIR" + +# +# Download + +echo -n "Downloading an archive from '$archive'..." +curl -sL "$archive" | tar zx -C "$QLOT_SOURCE_DIR" --strip-component 1 +echo "done" + +# +# Setup + +cd "$QLOT_SOURCE_DIR" + +mkdir -p "$QLOT_LOGS_DIR" +install_log_path="$QLOT_LOGS_DIR/install-$(date '+%s').log" +echo "Setting it up. This may take a while..." +scripts/setup.sh > "$install_log_path" 2>&1 + +if [ "$?" != "0" ]; then + errmsg "Setup process is failed. See '$install_log_path' for the detailed logs." + errmsg "If it can be a bug, please report an issue at https://github.com/fukamachi/qlot/issues." + exit $? +fi + +mkdir -p "$QLOT_BIN_DIR" +printf '#!/bin/sh\nexec %s/scripts/run.sh "$@"\n' "$QLOT_SOURCE_DIR" > "$QLOT_BIN_DIR/qlot" +chmod 755 "$QLOT_BIN_DIR/qlot" + +echo '' +success "Qlot v$(qlot_version) has been successfully installed under '$QLOT_HOME'." +echo '' + +if [ `id -u` != "0" ]; then + echo "The executable script is located at '$QLOT_BIN_DIR/qlot'." + echo "To make it runnable by your shell, please add '$QLOT_BIN_DIR' to '\$PATH'." + echo '' + echo " export PATH=\"$QLOT_BIN_DIR:\$PATH\"" + echo '' + echo 'Or, copy the script to a searchable directory such as /usr/local/bin.' + echo '' + echo " sudo cp $QLOT_BIN_DIR/qlot /usr/local/bin" + echo '' +fi +echo 'Enjoy!' |