-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.sh
executable file
·71 lines (59 loc) · 2.06 KB
/
installer.sh
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
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
REPO_URL="https://github.com/emreutkan/jukebox.git"
INSTALL_DIR="$HOME/jukebox"
if [ "$EUID" -ne 0 ]; then
echo -e "${RED}Please run as root (sudo ./installer.sh)${NC}"
exit
fi
if [ ! -d "$INSTALL_DIR" ]; then
echo -e "${GREEN}Creating installation directory at $INSTALL_DIR${NC}"
mkdir -p "$INSTALL_DIR"
fi
cd "$INSTALL_DIR" || exit
echo -e "${GREEN}Cloning the jukebox repository to the installation directory.${NC}"
git clone "$REPO_URL" .
if command -v pacman &> /dev/null; then
PACKAGE_MANAGER_INSTALL="sudo pacman -S --noconfirm"
PACKAGE_MANAGER_UPDATE="sudo pacman -Syu"
echo -e "${GREEN}Arch Based Distro detected.${NC}"
elif command -v apt-get &> /dev/null; then
PACKAGE_MANAGER_INSTALL="sudo apt-get install -y"
PACKAGE_MANAGER_UPDATE="sudo apt-get update"
echo -e "${GREEN}Debian Based Distro detected.${NC}"
else
echo -e "${RED}Supported package manager not found. Install packages manually.${NC}"
exit 1
fi
echo -e "${GREEN}Updating package manager${NC}"
$PACKAGE_MANAGER_UPDATE
DEPENDENCIES="aircrack-ng airgraph-ng net-tools python3 python3-pip python3-venv git"
for dep in $DEPENDENCIES; do
if ! command -v $dep &> /dev/null; then
echo -e "${GREEN}Installing $dep${NC}"
$PACKAGE_MANAGER_INSTALL $dep
else
echo -e "${GREEN}$dep already installed.${NC}"
fi
done
if [ ! -d "venv" ]; then
echo -e "${GREEN}Creating a virtual environment${NC}"
python3 -m venv venv
fi
echo -e "${GREEN}Activating the virtual environment and installing Python dependencies${NC}"
source venv/bin/activate
pip install -r requirements.txt
echo -e "${GREEN}Creating a jukebox command...${NC}"
echo "#!/bin/bash
if [ \"\$EUID\" -ne 0 ]; then
echo 'Please run as root (sudo jukebox)'
exit
fi
cd $INSTALL_DIR
source venv/bin/activate
exec \"$INSTALL_DIR/venv/bin/python\" jukebox.py" > jukebox
chmod +x jukebox
sudo mv jukebox /usr/local/bin/jukebox
echo -e "${GREEN}Installation complete. You can now run by typing 'sudo jukebox' in the terminal.${NC}"