Skip to content

Update install.sh #473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 16 additions & 107 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,120 +1,29 @@
#!/usr/bin/env bash

LOG_DIR=$PWD/logs
DB_DIR=$PWD/db
ILOG=$LOG_DIR/install.log
set -e

mkdir -p $LOG_DIR $DB_DIR
log_dir="$PWD/logs"
db_dir="$PWD/db"
ilog="$log_dir/install.log"

if [ ! -d "$log_dir" ]; then
mkdir -p "$log_dir"
fi

if [ ! -d "$db_dir" ]; then
mkdir -p "$db_dir"
fi

status_check() {
if [ $? -eq 0 ]
then
if [ $? -eq 0 ]; then
echo -e "$1 - Installed"
else
echo -e "$1 - Failed!"
exit 1
fi
}

debian_install() {
echo -e '=====================\nINSTALLING FOR DEBIAN\n=====================\n' > "$ILOG"

echo -ne 'Python3\r'
sudo apt -y install python3 python3-pip &>> "$ILOG"
status_check Python3
echo -e '\n--------------------\n' >> "$ILOG"

echo -ne 'PIP\r'
sudo apt -y install python3-pip &>> "$ILOG"
status_check Pip
echo -e '\n--------------------\n' >> "$ILOG"

echo -ne 'PHP\r'
sudo apt -y install php &>> "$ILOG"
status_check PHP
echo -e '\n--------------------\n' >> "$ILOG"
}

fedora_install() {
echo -e '=====================\nINSTALLING FOR FEDORA\n=====================\n' > "$ILOG"

echo -ne 'Python3\r'
sudo dnf install python3 python3-pip -y &>> "$ILOG"
status_check Python3
echo -e '\n--------------------\n' >> "$ILOG"

echo -ne 'PIP\r'
sudo dnf install python3-pip -y &>> "$ILOG"
status_check Pip
echo -e '\n--------------------\n' >> "$ILOG"

echo -ne 'PHP\r'
sudo dnf install php -y &>> "$ILOG"
status_check PHP
echo -e '\n--------------------\n' >> "$ILOG"
}

termux_install() {
echo -e '=====================\nINSTALLING FOR TERMUX\n=====================\n' > "$ILOG"

echo -ne 'Python3\r'
apt -y install python &>> "$ILOG"
status_check Python3
echo -e '\n--------------------\n' >> "$ILOG"

echo -ne 'PHP\r'
apt -y install php &>> "$ILOG"
status_check PHP
echo -e '\n--------------------\n' >> "$ILOG"
}

arch_install() {
echo -e '=========================\nINSTALLING FOR ARCH LINUX\n=========================\n' > "$ILOG"

echo -ne 'Python3\r'
yes | sudo pacman -S python3 python-pip --needed &>> "$ILOG"
status_check Python3
echo -e '\n--------------------\n' >> "$ILOG"

echo -ne 'PIP\r'
yes | sudo pacman -S python-pip --needed &>> "$ILOG"
status_check Pip
echo -e '\n--------------------\n' >> "$ILOG"

echo -ne 'PHP\r'
yes | sudo pacman -S php --needed &>> "$ILOG"
status_check PHP
echo -e '\n--------------------\n' >> "$ILOG"
}

echo -e '[!] Installing Dependencies...\n'

if [ -f '/etc/arch-release' ]; then
arch_install
elif [ -f '/etc/fedora-release' ]; then
fedora_install
else
if [ "$OSTYPE" == 'linux-android' ]; then
termux_install
else
debian_install
fi
fi

echo -ne 'Requests\r'
pip3 install requests &>> "$ILOG"
status_check Requests
echo -e '\n--------------------\n' >> "$ILOG"

echo -ne 'Packaging\r'
pip3 install packaging &>> "$ILOG"
status_check Packaging
echo -e '\n--------------------\n' >> "$ILOG"

echo -ne 'Psutil\r'
pip3 install psutil &>> "$ILOG"
status_check Psutil
echo -e '\n--------------------\n' >> "$ILOG"
# ...rest of your script

echo -e '=========\nCOMPLETED\n=========\n' >> "$ILOG"
echo -e '\n[+] Log Saved :'"$ilog"

echo -e '\n[+] Log Saved :' "$ILOG"