-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch.sh
More file actions
executable file
·92 lines (79 loc) · 2.31 KB
/
Copy pathlaunch.sh
File metadata and controls
executable file
·92 lines (79 loc) · 2.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
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
#!/bin/bash
# Splitux Launcher - Run this to start Splitux
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
info() { echo -e "${GREEN}[splitux]${NC} $1"; }
warn() { echo -e "${YELLOW}[splitux]${NC} $1"; }
error() { echo -e "${RED}[splitux]${NC} $1"; exit 1; }
# Detect distro and package manager
detect_distro() {
if [[ -f /etc/os-release ]]; then
. /etc/os-release
case "$ID" in
arch|cachyos|manjaro|endeavouros|garuda) PKG_MGR="pacman" ;;
fedora|nobara|bazzite|ultramarine) PKG_MGR="dnf" ;;
ubuntu|pop|linuxmint|elementary|zorin|debian|kali) PKG_MGR="apt" ;;
opensuse*|suse) PKG_MGR="zypper" ;;
*) PKG_MGR="unknown" ;;
esac
else
PKG_MGR="unknown"
fi
}
# Check runtime dependencies
check_deps() {
local missing=()
command -v bwrap >/dev/null 2>&1 || missing+=("bubblewrap")
command -v fuse-overlayfs >/dev/null 2>&1 || missing+=("fuse-overlayfs")
command -v slirp4netns >/dev/null 2>&1 || missing+=("slirp4netns")
if [[ ${#missing[@]} -eq 0 ]]; then
return 0
fi
echo ""
warn "Missing dependencies: ${missing[*]}"
echo ""
echo "Install them with:"
echo ""
case "$PKG_MGR" in
pacman)
echo -e " ${GREEN}sudo pacman -S ${missing[*]}${NC}"
;;
dnf)
echo -e " ${GREEN}sudo dnf install ${missing[*]}${NC}"
;;
apt)
echo -e " ${GREEN}sudo apt install ${missing[*]}${NC}"
;;
zypper)
echo -e " ${GREEN}sudo zypper install ${missing[*]}${NC}"
;;
*)
echo -e " Install: ${missing[*]}"
echo -e " (Use your distribution's package manager)"
;;
esac
echo ""
return 1
}
# Main
detect_distro
if ! check_deps; then
exit 1
fi
# Support --check-deps-only for install script
if [[ "${1:-}" == "--check-deps-only" ]]; then
exit 0
fi
# Find and run the binary
if [[ -f "$SCRIPT_DIR/splitux" ]]; then
exec "$SCRIPT_DIR/splitux" "$@"
elif [[ -f "$SCRIPT_DIR/build/splitux" ]]; then
exec "$SCRIPT_DIR/build/splitux" "$@"
else
error "splitux binary not found. If building from source, run: ./splitux.sh build"
fi