This commit is contained in:
29
install.sh
29
install.sh
@ -3,12 +3,6 @@ set -e
|
||||
|
||||
# download and install dropshell
|
||||
|
||||
# Check if running as root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "Please run this script as root (use sudo)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 1. Determine architecture
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
@ -30,21 +24,26 @@ trap 'rm -rf "$TMPDIR"' EXIT
|
||||
URL="https://gitea.jde.nz/public/dropshell/releases/download/latest/$BIN"
|
||||
echo "Downloading $BIN from $URL..."
|
||||
|
||||
curl -fsSL -o "$TMPDIR/dropshell" "$URL"
|
||||
TARGET_PATH="${HOME}/.local/bin/dropshell"
|
||||
|
||||
if [ ! -f "$TMPDIR/dropshell" ]; then
|
||||
mkdir -p "${HOME}/.local/bin"
|
||||
|
||||
curl -fsSL -o "$TARGET_PATH" "$URL"
|
||||
|
||||
if [ ! -f "$TARGET_PATH" ]; then
|
||||
echo "Failed to download dropshell" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chmod +x "$TMPDIR/dropshell"
|
||||
chmod +x "$TARGET_PATH"
|
||||
|
||||
cp "$TMPDIR/dropshell" /usr/local/bin/dropshell
|
||||
if [ -f /usr/local/bin/ds ]; then
|
||||
rm -f /usr/local/bin/ds
|
||||
if [ ! -f "${HOME}/.local/bin/ds" ]; then
|
||||
ln -s "$TARGET_PATH" "${HOME}/.local/bin/ds"
|
||||
fi
|
||||
ln -s /usr/local/bin/dropshell /usr/local/bin/ds
|
||||
rm -rf "$TMPDIR"
|
||||
|
||||
echo "dropshell installed successfully to /usr/local/bin/dropshell"
|
||||
echo "dropshell installed successfully to $TARGET_PATH"
|
||||
|
||||
echo "Please:"
|
||||
echo "1. run '${TARGET_PATH} edit' to edit the configuration."
|
||||
echo "2. run '${TARGET_PATH} install' to install dropshell components on this computer."
|
||||
echo "3. run 'source ~/.bashrc' to add to your path and autocomplete for the current shell."
|
||||
|
Reference in New Issue
Block a user