-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·113 lines (88 loc) · 3.32 KB
/
install.sh
File metadata and controls
executable file
·113 lines (88 loc) · 3.32 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
# Dotaz install/update script for macOS and Linux
# Usage: curl -fsSL https://raw.githubusercontent.com/contember/dotaz/main/install.sh | sh
set -e
REPO="contember/dotaz"
# ── Detect platform ─────────────────────────────────────────
OS=$(uname -s)
ARCH=$(uname -m)
case "$OS" in
Darwin) PLATFORM="macos" ;;
Linux) PLATFORM="linux" ;;
*) echo "Error: unsupported OS: $OS"; exit 1 ;;
esac
case "$ARCH" in
x86_64|amd64) ARCH="x64" ;;
arm64|aarch64) ARCH="arm64" ;;
*) echo "Error: unsupported architecture: $ARCH"; exit 1 ;;
esac
ARTIFACT="dotaz-${PLATFORM}-${ARCH}"
# ── Resolve version ─────────────────────────────────────────
if [ -z "$DOTAZ_VERSION" ]; then
DOTAZ_VERSION=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name"' | cut -d'"' -f4)
if [ -z "$DOTAZ_VERSION" ]; then
echo "Error: could not determine latest version"
exit 1
fi
fi
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${DOTAZ_VERSION}/${ARTIFACT}.tar.gz"
echo "Installing Dotaz ${DOTAZ_VERSION} (${PLATFORM}-${ARCH})..."
# ── Download and extract ────────────────────────────────────
TMP_DIR=$(mktemp -d)
cleanup() { rm -rf "$TMP_DIR"; }
trap cleanup EXIT
echo "Downloading ${DOWNLOAD_URL}..."
curl -fsSL "$DOWNLOAD_URL" -o "$TMP_DIR/dotaz.tar.gz"
tar -xzf "$TMP_DIR/dotaz.tar.gz" -C "$TMP_DIR"
# ── Install (platform-specific) ─────────────────────────────
if [ "$PLATFORM" = "macos" ]; then
# macOS: copy .app bundle to /Applications
APP_SRC=$(find "$TMP_DIR" -maxdepth 1 -name "*.app" -type d | head -1)
if [ -z "$APP_SRC" ]; then
echo "Error: no .app bundle found in archive"
exit 1
fi
APP_NAME=$(basename "$APP_SRC")
DEST="/Applications/${APP_NAME}"
echo "Installing to ${DEST}..."
[ -d "$DEST" ] && rm -rf "$DEST"
cp -R "$APP_SRC" /Applications/
echo "Done! Dotaz installed to /Applications/${APP_NAME}"
else
# Linux: install to ~/.local/share/dotaz, symlink launcher
INSTALL_DIR="${DOTAZ_INSTALL_DIR:-$HOME/.local/share/dotaz}"
BIN_DIR="${DOTAZ_BIN_DIR:-$HOME/.local/bin}"
APP_SRC=$(find "$TMP_DIR" -maxdepth 1 -type d -name "Dotaz*" | head -1)
if [ -z "$APP_SRC" ]; then
echo "Error: no Dotaz directory found in archive"
exit 1
fi
echo "Installing to ${INSTALL_DIR}..."
mkdir -p "$INSTALL_DIR"
rm -rf "${INSTALL_DIR:?}"/*
cp -r "$APP_SRC"/* "$INSTALL_DIR/"
# Create launcher symlink
mkdir -p "$BIN_DIR"
ln -sf "$INSTALL_DIR/bin/launcher" "$BIN_DIR/dotaz"
# Install .desktop entry
DESKTOP_DIR="$HOME/.local/share/applications"
mkdir -p "$DESKTOP_DIR"
cat > "$DESKTOP_DIR/dotaz.desktop" << EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=Dotaz
Comment=Desktop database client
Exec=${INSTALL_DIR}/bin/launcher
Icon=${INSTALL_DIR}/Resources/appIcon.png
Terminal=false
StartupWMClass=Dotaz
Categories=Development;Database;
EOF
echo "Done! Dotaz installed to ${INSTALL_DIR}"
if ! echo "$PATH" | grep -q "$BIN_DIR"; then
echo ""
echo " Add ~/.local/bin to your PATH to run 'dotaz' from terminal:"
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
fi
fi