-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·44 lines (37 loc) · 994 Bytes
/
Copy pathinstall.sh
File metadata and controls
executable file
·44 lines (37 loc) · 994 Bytes
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
#!/bin/bash
set -euo pipefail
# CONFIG
SRC_DIR="$(pwd)"
INSTALL_DIR="/opt/zman"
WRAPPER="/usr/local/bin/zman"
# Ensure the source directory exists
if [[ ! -d "$SRC_DIR" || ! -f "$SRC_DIR/zman.sh" ]]; then
echo "[ERROR] ZMAN source directory or zman.sh not found at $SRC_DIR"
exit 1
fi
# Step 1: Move to /opt
echo "[INFO] Installing ZMAN to $INSTALL_DIR..."
sudo rm -rf "$INSTALL_DIR"
sudo cp -r "$SRC_DIR" "$INSTALL_DIR"
sudo chmod -R 755 "$INSTALL_DIR"
# Step 2: Create wrapper
echo "[INFO] Creating wrapper at $WRAPPER..."
sudo tee "$WRAPPER" >/dev/null <<EOF
#!/bin/bash
exec $INSTALL_DIR/zman.sh "\$@"
EOF
sudo chmod +x "$WRAPPER"
# Step 3: Logfile setup
sudo mkdir -p /var/log
sudo touch /var/log/zman.log
sudo chmod 644 /var/log/zman.log
# Step 4: Verify
echo "[INFO] Verifying installation..."
if command -v zman >/dev/null; then
echo "[SUCCESS] ZMAN is installed and available as 'zman'"
echo
zman --help
else
echo "[ERROR] Wrapper not available in PATH"
exit 1
fi