-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
97 lines (86 loc) · 2.74 KB
/
Copy pathsetup.sh
File metadata and controls
97 lines (86 loc) · 2.74 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
#!/bin/bash
echo "==================================================="
echo " Assignment System - Automated Setup (Ubuntu) "
echo "==================================================="
echo
# 1. Check for Python
if command -v python3 &> /dev/null; then
PYTHON_CMD="python3"
elif command -v python &> /dev/null; then
PYTHON_CMD="python"
else
echo "[ERROR] Python 3 is not installed or not in PATH."
exit 1
fi
echo "[OK] Python found: $PYTHON_CMD"
# 1.5 Check for Tkinter (required for GUI)
if command -v apt-get &> /dev/null; then
echo "[INFO] Checking for tkinter (python3-tk) dependency..."
if ! dpkg -s python3-tk &> /dev/null; then
echo "[INFO] Installing python3-tk (may require sudo password)..."
sudo apt-get update && sudo apt-get install -y python3-tk
else
echo "[OK] tkinter is installed."
fi
fi
# 2. Check for Node.js (npm)
if ! command -v npm &> /dev/null; then
echo "[ERROR] Node.js (npm) is not installed. Please install Node.js."
exit 1
fi
echo "[OK] Node.js and npm found."
SCRIPT_DIR=$(dirname "$(realpath "$0")")
cd "$SCRIPT_DIR" || exit
echo
echo "=== 1. Setting up Python Virtual Environment ==="
if [ ! -d ".venv" ]; then
$PYTHON_CMD -m venv .venv
echo "[OK] Virtual environment created."
else
echo "[INFO] Virtual environment already exists."
fi
VENV_PYTHON="$SCRIPT_DIR/.venv/bin/python"
echo
echo "=== 2. Installing Backend Dependencies ==="
"$VENV_PYTHON" -m pip install --no-cache-dir --upgrade pip
"$VENV_PYTHON" -m pip install --no-cache-dir -r requirements.txt
if [ $? -ne 0 ]; then
echo "[ERROR] Failed to install python requirements."
exit 1
fi
echo "[OK] Backend dependencies installed."
echo
echo "=== 3. Installing Frontend Dependencies ==="
if [ -d "Frontend/system_interface" ]; then
cd Frontend/system_interface || exit
npm install
cd ../..
fi
echo "[OK] Frontend dependencies installed."
echo
echo "=== 4. Installing the Lockdown Daemon ==="
# Ensure install_daemon.sh is executable and run it
chmod +x install_daemon.sh
./install_daemon.sh
echo
echo "=== 5. Creating Desktop Shortcut ==="
DESKTOP_FILE="$HOME/Desktop/Assignment System.desktop"
cat > "$DESKTOP_FILE" << EOF
[Desktop Entry]
Version=1.0
Name=Assignment System
Comment=Start the Assignment System
Exec=bash -c "cd '$SCRIPT_DIR' && '$VENV_PYTHON' launcher.py"
Icon=utilities-terminal
Terminal=true
Type=Application
Categories=Application;
EOF
chmod +x "$DESKTOP_FILE"
echo "[OK] Desktop shortcut created at $DESKTOP_FILE"
echo
echo "==================================================="
echo " Setup Complete! You can now use the Desktop "
echo " shortcut 'Assignment System' to launch it! "
echo "==================================================="
read -p "Press Enter to exit..."