Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·186 lines (164 loc) · 7.25 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·186 lines (164 loc) · 7.25 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#!/usr/bin/env bash
set -e
BUILD_DIR="$HOME/.cache/azterm-build"
REPO_URL="https://github.com/AZBrandCanada/azTerm.git"
if [ -f "$HOME/.cargo/env" ]; then
source "$HOME/.cargo/env"
fi
export PATH="$HOME/.cargo/bin:$PATH"
echo "[1/5] Checking build dependencies..."
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "Detected macOS system."
if ! command -v cc &>/dev/null; then
echo "Xcode Command Line Tools missing. Installing..."
xcode-select --install || true
fi
elif command -v pacman &>/dev/null; then
sudo pacman -S --needed --noconfirm base-devel git libxkbcommon openssl libxcb libx11 wayland mesa
elif command -v apt-get &>/dev/null; then
sudo apt-get update -qq
sudo apt-get install -y -qq build-essential git pkg-config libxkbcommon-dev libssl-dev libxcb1-dev libx11-dev libwayland-dev libgl1-mesa-dev
elif command -v dnf &>/dev/null; then
sudo dnf install -y git gcc gcc-c++ make pkgconf-pkg-config libxkbcommon-devel openssl-devel libxcb-devel libX11-devel wayland-devel mesa-libGL-devel
elif command -v zypper &>/dev/null; then
sudo zypper install -y git gcc gcc-c++ make pkg-config libxkbcommon-devel libopenssl-devel libxcb-devel libX11-devel wayland-devel Mesa-libGL-devel
fi
# Ensure Rust/Cargo is available
if ! command -v cargo &>/dev/null; then
echo "Installing Rust toolchain via rustup..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
export PATH="$HOME/.cargo/bin:$PATH"
fi
echo "[2/5] Preparing source repository in persistent build cache ($BUILD_DIR)..."
mkdir -p "$HOME/.cache"
if [ -d "$BUILD_DIR/.git" ]; then
echo "Updating existing build cache..."
cd "$BUILD_DIR"
git fetch --all --tags || true
git checkout -f main 2>/dev/null || git checkout -f master 2>/dev/null || true
git reset --hard origin/main 2>/dev/null || git reset --hard origin/master 2>/dev/null || true
git clean -fd || true
else
echo "Cloning repository..."
rm -rf "$BUILD_DIR"
git clone --depth 1 "$REPO_URL" "$BUILD_DIR"
cd "$BUILD_DIR"
fi
echo "[3/5] Compiling AZTerm..."
cargo build --release
echo "[4/5] Installing binary and integrations..."
if [[ "$OSTYPE" == "darwin"* ]]; then
# 1. Ensure /usr/local/bin exists and install binary for terminal use
sudo mkdir -p /usr/local/bin
sudo cp target/release/azterm /usr/local/bin/azterm
sudo chmod +x /usr/local/bin/azterm
# Fallback copy to user local directory
mkdir -p "$HOME/.local/bin"
cp target/release/azterm "$HOME/.local/bin/azterm"
# 2. Create macOS .app bundle for Applications / Launchpad / Spotlight
APP_DIR="/Applications/AZTerm.app/Contents"
sudo mkdir -p "$APP_DIR/MacOS" "$APP_DIR/Resources"
sudo cp target/release/azterm "$APP_DIR/MacOS/azterm"
sudo chmod +x "$APP_DIR/MacOS/azterm"
# Copy icon if available
if [ -f "assets/azterm.icns" ]; then
sudo cp assets/azterm.icns "$APP_DIR/Resources/azterm.icns"
fi
# Create Info.plist so macOS recognizes it as a GUI application
cat <<EOF | sudo tee "$APP_DIR/Info.plist" > /dev/null
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>azterm</string>
<key>CFBundleIdentifier</key>
<string>com.azbrand.azterm</string>
<key>CFBundleName</key>
<string>AZTerm</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.6.3</string>
<key>CFBundleIconFile</key>
<string>azterm</string>
</dict>
</plist>
EOF
echo "[5/5] macOS installation complete!"
else
# Linux Installation Path
sudo mkdir -p /usr/local/bin /usr/share/applications /usr/share/icons/hicolor/scalable/apps /usr/share/kio/servicemenus /usr/share/nemo/actions
sudo install -Dm755 target/release/azterm /usr/local/bin/azterm
declare -A SEEN_LOCS
LOCATIONS=(
"/usr/local/bin/azterm"
"/usr/bin/azterm"
"$HOME/.local/bin/azterm"
"$HOME/.cargo/bin/azterm"
"$HOME/bin/azterm"
)
if command -v which &>/dev/null; then
while IFS= read -r path; do
if [ -n "$path" ]; then
LOCATIONS+=("$path")
fi
done < <(which -a azterm 2>/dev/null || true)
fi
for loc in "${LOCATIONS[@]}"; do
if [ -n "$loc" ] && [ -z "${SEEN_LOCS[$loc]}" ]; then
SEEN_LOCS["$loc"]=1
if [ -e "$loc" ] || [ -L "$loc" ] || [ "$loc" = "$HOME/.local/bin/azterm" ]; then
dir_name=$(dirname "$loc")
if [ -w "$dir_name" ]; then
install -Dm755 target/release/azterm "$loc" 2>/dev/null || true
else
sudo install -Dm755 target/release/azterm "$loc" 2>/dev/null || true
fi
fi
fi
done
# Desktop Entry & Icon
if [ -f "assets/azterm.desktop" ]; then
sudo install -Dm644 assets/azterm.desktop /usr/share/applications/azterm.desktop
mkdir -p "$HOME/.local/share/applications"
install -Dm644 assets/azterm.desktop "$HOME/.local/share/applications/azterm.desktop"
fi
if [ -f "assets/azterm.svg" ]; then
sudo install -Dm644 assets/azterm.svg /usr/share/icons/hicolor/scalable/apps/azterm.svg
mkdir -p "$HOME/.local/share/icons/hicolor/scalable/apps"
install -Dm644 assets/azterm.svg "$HOME/.local/share/icons/hicolor/scalable/apps/azterm.svg"
fi
# KDE Dolphin Context Menu
if [ -f "assets/servicemenus/azterm_open.desktop" ]; then
sudo install -Dm755 assets/servicemenus/azterm_open.desktop /usr/share/kio/servicemenus/azterm_open.desktop
mkdir -p "$HOME/.local/share/kio/servicemenus"
install -Dm755 assets/servicemenus/azterm_open.desktop "$HOME/.local/share/kio/servicemenus/azterm_open.desktop"
chmod +x "$HOME/.local/share/kio/servicemenus/azterm_open.desktop"
fi
# Nemo File Manager Action
if [ -f "assets/nemo/azterm.nemo_action" ]; then
mkdir -p "$HOME/.local/share/nemo/actions"
install -Dm644 assets/nemo/azterm.nemo_action "$HOME/.local/share/nemo/actions/azterm.nemo_action"
sudo install -Dm644 assets/nemo/azterm.nemo_action /usr/share/nemo/actions/azterm.nemo_action 2>/dev/null || true
fi
echo "[5/5] Updating Linux desktop database and caches..."
if command -v update-desktop-database &>/dev/null; then
sudo update-desktop-database -q /usr/share/applications 2>/dev/null || true
update-desktop-database -q "$HOME/.local/share/applications" 2>/dev/null || true
fi
if command -v gtk-update-icon-cache &>/dev/null; then
sudo gtk-update-icon-cache -q /usr/share/icons/hicolor 2>/dev/null || true
fi
if command -v kbuildsycoca6 &>/dev/null; then
kbuildsycoca6 --noincremental 2>/dev/null || true
elif command -v kbuildsycoca5 &>/dev/null; then
kbuildsycoca5 --noincremental 2>/dev/null || true
fi
fi
hash -r 2>/dev/null || true
echo "=========================================================="
echo " AZTerm installation complete!"
echo " Active binary: $(which azterm 2>/dev/null || echo '/usr/local/bin/azterm')"
echo "=========================================================="