Skip to content

Commit d571223

Browse files
committed
Update setup.sh
1 parent 80d59ee commit d571223

File tree

2 files changed

+35
-16
lines changed

2 files changed

+35
-16
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ core/static/.DS_Store
99
core/static/__pycache__
1010
core/sources/*.pyc
1111
core/sources/.DS_Store
12-
core/sources/__pycache__
12+
core/sources/__pycache__
13+
scripts/

setup.sh

+33-15
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,51 @@
11
#!/usr/bin/env bash
22

3+
#
4+
# This script automates the setup process for redirect.rules and
5+
# automatically installs any and all modules and tools. Once the
6+
# environment is built, run the redirect.rules tool:
7+
# python3 redirect_rules.py -d test.com
8+
#
9+
# Follow the instructions within the /tmp/redirect.rules file
10+
# for use with Apache2
11+
#
12+
13+
14+
# Make sure we are running this script as root
15+
if [[ $EUID -ne 0 ]]; then
16+
echo -e '[!]\tThis script must be run as root'
17+
exit 1
18+
fi
19+
20+
321
# Update the target system
4-
echo -e '\n[*]\tUpdating system...'
5-
sudo apt -qq update
22+
echo -e '[*]\tUpdating system'
23+
apt-get -qq update
624

725
# Install the required tools and dependencies on the system
8-
echo -e '[*]\tInstalling required tools...'
9-
sudo apt -qq install -y whois \
10-
python3 \
11-
python3-pip
26+
echo -e '[*]\tInstalling required system tools'
27+
apt-get -qq install -y whois \
28+
python3 \
29+
python3-pip
1230

1331
# Ensure Python3 is upgraded if it was already installed
14-
echo -e '[*]\tUpdating Python3...'
15-
sudo apt -qq --only-upgrade install -y python3
32+
echo -e '[*]\tUpdating Python3'
33+
apt-get -qq --only-upgrade install -y python3
1634

1735
# Perform clean up
18-
echo -e '[*]\tPerforming clean up...'
19-
sudo apt -qq -y autoremove
20-
sudo apt -qq -y clean
21-
sudo rm -rf /var/lib/apt/lists/*
36+
echo -e '[*]\tPerforming system clean up'
37+
apt-get -qq -y autoremove
38+
apt-get -qq -y clean
39+
rm -rf /var/lib/apt/lists/*
2240

2341
# Now install Python dependencies
24-
echo -e '[*]\tInstalling Python dependencies...'
42+
echo -e '[*]\tInstalling Python dependencies'
2543
pip3 install --quiet --no-cache-dir -r requirements.txt
2644

2745
# If we are on the system running Apache, let's enable mod_rewrite
2846
if dpkg --get-selections | grep '^apache2\s.*install'; then
29-
echo -e '[*]\tEnabling mod_rewrite for Apache...'
30-
sudo a2enmod rewrite
47+
echo -e '[*]\tEnabling mod_rewrite for Apache'
48+
a2enmod rewrite
3149
fi
3250

3351
echo -e '\n[+]\tSet up complete for redirect.rules'

0 commit comments

Comments
 (0)