forked from lyarinet/Samba-Manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_app.sh
More file actions
executable file
·59 lines (51 loc) · 1.64 KB
/
Copy pathrun_app.sh
File metadata and controls
executable file
·59 lines (51 loc) · 1.64 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
#!/bin/bash
# Script to run the Samba Manager application
# Check if Python 3 is installed
if command -v python3 &>/dev/null; then
PYTHON_CMD="python3"
elif command -v python &>/dev/null; then
PYTHON_CMD="python"
else
echo "Error: Python not found. Please install Python 3."
exit 1
fi
# Check if Samba is installed
if ! command -v smbd &>/dev/null; then
echo "Warning: Samba is not installed or not in PATH."
echo "For full functionality, please run: sudo ./setup_samba.sh"
echo "Continuing in development mode..."
fi
# Check if shares.conf exists
if [ ! -f "/etc/samba/shares.conf" ]; then
echo "Warning: /etc/samba/shares.conf not found."
echo "For full functionality, please run: sudo ./setup_samba.sh"
echo "Continuing in development mode..."
fi
# Check if virtual environment exists, create if not
if [ ! -d "venv" ]; then
echo "Creating virtual environment..."
$PYTHON_CMD -m venv venv
if [ $? -ne 0 ]; then
echo "Error: Failed to create virtual environment. Make sure python3-venv is installed."
echo "Try: sudo apt-get install python3-venv"
exit 1
fi
fi
# Activate virtual environment and install dependencies
echo "Activating virtual environment and installing dependencies..."
source venv/bin/activate
pip install -r requirements.txt
# Start terminal service
echo "Starting terminal service..."
./start_terminal_service.sh
# Check if app is running with sudo
if [ "$EUID" -eq 0 ]; then
echo "Running in production mode with sudo..."
export SAMBA_MANAGER_DEV_MODE=0
else
echo "Running in development mode..."
export SAMBA_MANAGER_DEV_MODE=1
fi
# Run the application
echo "Starting Samba Manager..."
$PYTHON_CMD run.py