-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·106 lines (92 loc) · 4.84 KB
/
install.sh
File metadata and controls
executable file
·106 lines (92 loc) · 4.84 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
#!/usr/bin/env bash
set -euo pipefail
APP_NAME="cortex"
INSTALL_DIR="/opt/${APP_NAME}"
BIN_LINK="/usr/local/bin/${APP_NAME}"
DESKTOP_DIR="/usr/share/applications"
ICON_SRC_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/data/icons"
HICOLOR_DIR="/usr/share/icons/hicolor"
# ── Color helpers ─────────────────────────────────────────────────────────────
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; NC='\033[0m'
info() { echo -e "${GREEN}[✓]${NC} $*"; }
warn() { echo -e "${YELLOW}[!]${NC} $*"; }
error() { echo -e "${RED}[✗]${NC} $*" >&2; exit 1; }
# ── Root check ────────────────────────────────────────────────────────────────
if [[ $EUID -ne 0 ]]; then
warn "Not running as root — re-launching with sudo..."
exec sudo bash "$0" "$@"
fi
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " Cortex — Installer"
echo " Ubuntu / Debian / Kali"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# ── Dependency check and install ─────────────────────────────────────────────
APT_PKGS=(
python3
python3-gi
python3-gi-cairo
gir1.2-gtk-4.0
gir1.2-adw-1
gir1.2-pango-1.0
tor
curl
nftables
)
info "Checking required packages..."
MISSING=()
for pkg in "${APT_PKGS[@]}"; do
if ! dpkg-query -W -f='${Status}' "$pkg" 2>/dev/null | grep -q "install ok installed"; then
MISSING+=("$pkg")
fi
done
if [[ ${#MISSING[@]} -gt 0 ]]; then
warn "Installing missing packages: ${MISSING[*]}"
apt-get update -qq
apt-get install -y -qq "${MISSING[@]}"
info "Packages installed."
else
info "All required packages present."
fi
if ! python3 -c "import stem" 2>/dev/null; then
warn "stem not found — Tor circuit info limited."
warn "Install: pip3 install stem OR apt install python3-stem"
fi
# ── Copy application files ────────────────────────────────────────────────────
SRC_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
info "Installing application to ${INSTALL_DIR}..."
rm -rf "${INSTALL_DIR}"
mkdir -p "${INSTALL_DIR}"
cp -r "${SRC_DIR}/cortex" "${INSTALL_DIR}/"
cp "${SRC_DIR}/run.py" "${INSTALL_DIR}/"
# ── Create launcher ───────────────────────────────────────────────────────────
info "Creating launcher at ${BIN_LINK}..."
cat > "${BIN_LINK}" << 'LAUNCHER'
#!/usr/bin/env bash
exec python3 /opt/cortex/run.py "$@"
LAUNCHER
chmod +x "${BIN_LINK}"
# ── Install icons ─────────────────────────────────────────────────────────────
info "Installing icons..."
for size in 16 24 32 48 64 96 128 256 512; do
dir="${HICOLOR_DIR}/${size}x${size}/apps"
mkdir -p "${dir}"
cp "${ICON_SRC_DIR}/cortex-${size}.png" "${dir}/cortex.png"
done
mkdir -p "${HICOLOR_DIR}/scalable/apps"
cp "${ICON_SRC_DIR}/cortex.svg" "${HICOLOR_DIR}/scalable/apps/cortex.svg"
gtk-update-icon-cache -f -t "${HICOLOR_DIR}" 2>/dev/null || true
# ── Install desktop entry ─────────────────────────────────────────────────────
info "Installing desktop entry..."
cp "${SRC_DIR}/data/cortex.desktop" "${DESKTOP_DIR}/cortex.desktop"
update-desktop-database "${DESKTOP_DIR}" 2>/dev/null || true
# ── Done ──────────────────────────────────────────────────────────────────────
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
info "Installation complete!"
echo ""
echo " Run from terminal: cortex"
echo " Or find it in: Applications → System"
echo ""
echo " Tor service: sudo systemctl start tor"
echo " Tor on boot: sudo systemctl enable tor"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"