-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·51 lines (40 loc) · 1.31 KB
/
install.sh
File metadata and controls
executable file
·51 lines (40 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
set -Eeuo pipefail
REPO_URL="https://github.com/sevmorris/WaxOff.git"
DEST="${HOME}/WaxOff"
BIN_DIR="${HOME}/bin"
ALT_BIN="${HOME}/.local/bin"
LINK_NAME="waxoff"
echo "==> Installing WaxOff to ${DEST} and symlinking ${LINK_NAME}..."
command -v git >/dev/null 2>&1 || { echo "Error: git is required."; exit 1; }
if [[ -d "${DEST}/.git" ]]; then
echo "==> Updating existing repo..."
git -C "${DEST}" pull --ff-only
else
echo "==> Cloning repo..."
git clone --depth=1 "${REPO_URL}" "${DEST}"
fi
if [[ ! -f "${DEST}/${LINK_NAME}" ]]; then
echo "Error: ${LINK_NAME} not found at ${DEST}/${LINK_NAME}"
exit 1
fi
chmod +x "${DEST}/${LINK_NAME}"
# Prefer ~/.local/bin if it exists; otherwise use ~/bin
if [[ -d "${ALT_BIN}" ]]; then
INSTALL_BIN="${ALT_BIN}"
else
INSTALL_BIN="${BIN_DIR}"
fi
mkdir -p "${INSTALL_BIN}"
ln -sf "${DEST}/${LINK_NAME}" "${INSTALL_BIN}/${LINK_NAME}"
echo "==> Symlinked ${INSTALL_BIN}/${LINK_NAME}"
# Helpful hints
if ! command -v ffmpeg >/dev/null 2>&1; then
echo "Note: ffmpeg not found. Install it (e.g., 'brew install ffmpeg' on macOS)."
fi
if ! command -v "${LINK_NAME}" >/dev/null 2>&1; then
echo "Add to PATH: export PATH=\"${INSTALL_BIN}:$PATH\""
fi
# Friendly probe (non-fatal)
"${INSTALL_BIN}/${LINK_NAME}" --version >/dev/null 2>&1 || true
echo "==> Done."