mirror of
https://github.com/runebookai/tome.git
synced 2025-07-21 00:27:30 +03:00
70 lines
1.9 KiB
Bash
Executable File
70 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# This product includes software developed at Square, Inc.
|
|
#
|
|
# The Initial Developer of some parts of the framework, which are copied
|
|
# from, derived from, or inspired by Hermit, is Square, Inc. (https://squareup.com).
|
|
# Copyright 2021 Square, Inc. All Rights Reserved.
|
|
#
|
|
# The Initial Developer of Hermit is Square, Inc. (http://www.squareup.com).
|
|
# Copyright 2021 Square, Inc. All Rights Reserved.
|
|
|
|
set -euo pipefail
|
|
|
|
LOGFILE="/tmp/runebook_uvx.log"
|
|
> "$LOGFILE"
|
|
|
|
log() {
|
|
local LINE="$1"
|
|
echo "$(date +'%Y-%m-%d %H:%M:%S') :: $LINE" >> $LOGFILE
|
|
}
|
|
trap 'log "ERROR: Exiting w/ status: $?."' ERR
|
|
|
|
log "Starting..."
|
|
|
|
log "mkdir -p ~/.config/runebook/hermit/bin ?"
|
|
mkdir -p ~/.config/runebook/hermit/bin
|
|
|
|
log "cd ~/.config/runebook/hermit"
|
|
cd ~/.config/runebook/hermit
|
|
|
|
if [ ! -f ~/.config/runebook/hermit/bin/hermit ]; then
|
|
log "Downloading hermit..."
|
|
curl -fsSL "https://github.com/cashapp/hermit/releases/download/stable/hermit-$(uname -s \
|
|
| tr '[:upper:]' '[:lower:]')-$(uname -m \
|
|
| sed 's/x86_64/amd64/' \
|
|
| sed 's/aarch64/arm64/').gz" \
|
|
| gzip -dc > ~/.config/runebook/hermit/bin/hermit
|
|
log "Downloaded hermit..."
|
|
|
|
log "chmod +x ~/.config/runebook/hermit/bin/hermit"
|
|
chmod +x ~/.config/runebook/hermit/bin/hermit
|
|
else
|
|
log "Found existing hermit..."
|
|
fi
|
|
|
|
log "mkdir -p ~/.config/runebook/hermit/cache"
|
|
mkdir -p ~/.config/runebook/hermit/cache
|
|
|
|
log "export HERMIT_STATE_DIR=~/.config/runebook/hermit/cache"
|
|
export HERMIT_STATE_DIR=~/.config/runebook/hermit/cache
|
|
|
|
log "export PATH=~/.config/runebook/hermit/bin:$PATH"
|
|
export PATH=~/.config/runebook/hermit/bin:$PATH
|
|
|
|
log "hermit init"
|
|
hermit init >> "$LOGFILE"
|
|
|
|
log "chmod +x hermit"
|
|
chmod +x ~/.config/runebook/hermit/bin/hermit
|
|
|
|
log "hermit install python@3.12"
|
|
hermit install python3@3.12 >> "$LOGFILE"
|
|
|
|
log "hermit install uv"
|
|
hermit install uv >> "$LOGFILE"
|
|
|
|
log "uvx $*"
|
|
uvx "$@" || log "Error running uvx $*"
|
|
|
|
log "End."
|