forked from TahaGorme/InstaMassUnliker
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.sh
More file actions
139 lines (120 loc) · 3.94 KB
/
Copy pathrun.sh
File metadata and controls
139 lines (120 loc) · 3.94 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/usr/bin/env bash
# Color codes
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
MAGENTA='\033[0;35m'
CYAN='\033[0;36m'
NC='\033[0m'
# Detect OS
if [[ "$OSTYPE" == "darwin"* ]]; then
OS="macOS"
elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
OS="Windows"
else
OS="Linux"
fi
# Function to check for root/sudo
check_root() {
if [ "$OS" != "Windows" ] && [ "$EUID" -ne 0 ]; then
echo -e "${RED}[!] Error: This script requires root privileges${NC}"
echo -e "${YELLOW}[i] Please run with sudo${NC}"
exit 1
fi
}
# Function to install package manager
install_package_manager() {
if [ "$OS" = "macOS" ]; then
if ! command -v brew &> /dev/null; then
echo -e "${YELLOW}[+] Installing Homebrew...${NC}"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" || {
echo -e "${RED}[!] Failed to install Homebrew${NC}"
exit 1
}
fi
elif [ "$OS" = "Linux" ]; then
if ! command -v apt-get &> /dev/null && ! command -v dnf &> /dev/null; then
echo -e "${RED}[!] No supported package manager found${NC}"
exit 1
fi
fi
}
# Function to install a package
install_package() {
local package=$1
echo -e "${BLUE}[*] Checking $package installation...${NC}"
if ! command -v $package &> /dev/null; then
echo -e "${YELLOW}[+] Installing $package...${NC}"
if [ "$OS" = "macOS" ]; then
brew install $package || return 1
elif [ "$OS" = "Linux" ]; then
if command -v apt-get &> /dev/null; then
apt-get update && apt-get install -y $package || return 1
elif command -v dnf &> /dev/null; then
dnf install -y $package || return 1
fi
fi
fi
echo -e "${GREEN}[✓] $package check passed${NC}"
return 0
}
# Header
echo -e "${BLUE}[*]=======================================${NC}"
echo -e "${YELLOW}[+] Instagram Mass Unliker - Setup Utility${NC}"
echo -e "${BLUE}[*]=======================================${NC}"
echo
# Check root privileges
check_root
# Install package manager
install_package_manager
# Install required packages
for package in git python3 python3-pip ffmpeg; do
install_package $package || {
echo -e "${RED}[!] Failed to install $package${NC}"
exit 1
}
done
# Check Python version
echo -e "${BLUE}[*] Checking Python version...${NC}"
python3 -c "import sys; sys.exit(0 if sys.version_info >= (3,7) else 1)" || {
echo -e "${RED}[!] Error: Python 3.7 or higher required${NC}"
exit 1
}
echo -e "${GREEN}[✓] Python version check passed${NC}"
# Set up virtual environment
echo -e "${BLUE}[*] Setting up virtual environment...${NC}"
if [ ! -d "venv" ]; then
python3 -m venv venv || {
echo -e "${RED}[!] Failed to create virtual environment${NC}"
exit 1
}
fi
# Activate virtual environment
if [ "$OS" = "Windows" ]; then
source venv/Scripts/activate
else
source venv/bin/activate
fi
if [ $? -ne 0 ]; then
echo -e "${RED}[!] Failed to activate virtual environment${NC}"
exit 1
fi
# Install Python dependencies
echo -e "${BLUE}[*] Installing Python dependencies...${NC}"
python -m pip install --upgrade pip
pip install ensta==5.2.9 tqdm==4.67.1 colorama==0.4.6 requests==2.32.3 || {
echo -e "${RED}[!] Failed to install Python dependencies${NC}"
exit 1
}
echo -e "${GREEN}[✓] Virtual environment setup complete${NC}"
# Run the main script
echo -e "${BLUE}[*] Starting Instagram Mass Unliker...${NC}"
python instagram_unliker.py
if [ $? -ne 0 ]; then
echo -e "${RED}[!] Program exited with errors${NC}"
exit 1
fi
# Deactivate virtual environment
deactivate
echo -e "${GREEN}[✓] Program completed successfully${NC}"