Skip to content
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

version and root check #326

Merged
merged 3 commits into from
Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
65 changes: 48 additions & 17 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,58 @@
#!/bin/bash
command -v jq >/dev/null 2>&1 || { JQ=0;}
command -v python3 >/dev/null 2>&1 || { PY=0;}
command -v python >/dev/null 2>&1 || { PY=0;}
if [ "${EUID}" -ne 0 ]; then
echo "You need to run this script as root."
exit 1
fi
#install python
if [[ $PY -ne 0 ]]; then
if [[ -e /etc/debian_version ]]; then
apt install python3
elif [[ -e /etc/fedora-release ]]; then
dnf install python3
elif [[ -e /etc/centos-release ]]; then
yum install -y python3
elif [[ -e /etc/arch-release ]]; then
pacman -Sy python3
else
echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora, CentOS, or Arch Linux system."
exit 1
fi
else
echo "Skipping installing python, as python is preinstalled"
fi
#install tkinter, a dependency
#install jq, needed to get version number
if [[ -e /etc/debian_version ]]; then
apt install python3 python3-tk
apt install python3-tk jq
elif [[ -e /etc/fedora-release ]]; then
dnf install python3
dnf install python3-tkinter
dnf install python3-tkinter jq
elif [[ -e /etc/centos-release ]]; then
yum install -y python3
yum install tkinter
yum install -y tkinter epel-release jq
elif [[ -e /etc/arch-release ]]; then
pacman -Sy python3 tk
pacman -Sy tk jq
fi
command -v pip >/dev/null 2>&1 || { sudo -u $USER curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py; sudo -u $USER python3 get-pip.py --no-warn-script-location; rm get-pip.py; }
TAG=$(curl https://api.github.com/repos/ThioJoe/YT-Spammer-Purge/releases/latest -s | jq .name -r)
if [[ $JQ -ne 0 ]]; then
if [[ -e /etc/debian_version ]]; then
apt purge jq
elif [[ -e /etc/fedora-release ]]; then
dnf remove jq
elif [[ -e /etc/centos-release ]]; then
yum remove jq epel-release
elif [[ -e /etc/arch-release ]]; then
pacman -Rs jq
fi
else
echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora, CentOS, Arch Linux system."
exit 1
echo "Did not unistall jq as it was preinstalled before running this script."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Did not uninstall jq ..."

fi
sudo -u $USER curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo -u $USER python3 get-pip.py --no-warn-script-location
# Uncomment if running this script alone, to also install the files for YT-Spammer-Purge
: 'sudo -u $USER curl https://codeload.github.com/ThioJoe/YT-Spammer-Purge/tar.gz/refs/tags/v2.6.1 -o yt-spammer.tar.gz
# Uncomment if running this script alone, to also install the files for Youtube-Spammer-Purge
: 'curl https://codeload.github.com/ThioJoe/YT-Spammer-Purge/tar.gz/refs/tags/v${TAG} -o yt-spammer.tar.gz
sudo -u $USER tar -xzf yt-spammer.tar.gz
sudo -u $USER rm yt-spammer.tar.gz
sudo -u $USER cd YT-Spammer-Purge-2.6.1/'
sudo -u $USER rm get-pip.py
sudo -u $USER pip -q install -r requirements.txt
printf "Dependencies and Program installed!\nNow follow these instructions to get a client_secrets.json file!\nhttps://github.com/ThioJoe/YT-Spammer-Purge/wiki/Instructions:-Obtaining-an-API-Key\n"
rm yt-spammer.tar.gz
cd YouTube-Spammer-Purge-${TAG}/'
sudo -u $USER bash -c "pip install -r requirements.txt"
printf "Dependencies and Program installed!\nNow follow these instructions to get a client_secrets.json file!\nhttps://github.com/ThioJoe/YouTube-Spammer-Purge#instructions---obtaining-youtube-api-key\n"
68 changes: 50 additions & 18 deletions install_full.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,58 @@
#!/bin/bash
#install python and tkinter, a dependency
command -v jq >/dev/null 2>&1 || { JQ=0;}
command -v python3 >/dev/null 2>&1 || { PY=0;}
command -v python >/dev/null 2>&1 || { PY=0;}
if [ "${EUID}" -ne 0 ]; then
echo "You need to run this script as root."
exit 1
fi
#install python
if [[ $PY -ne 0 ]]; then
if [[ -e /etc/debian_version ]]; then
apt install python3
elif [[ -e /etc/fedora-release ]]; then
dnf install python3
elif [[ -e /etc/centos-release ]]; then
yum install -y python3
elif [[ -e /etc/arch-release ]]; then
pacman -Sy python3
else
echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora, CentOS, or Arch Linux system."
exit 1
fi
else
echo "Skipping installing python, as python is preinstalled"
fi
#install tkinter, a dependency
#install jq, needed to get version number
if [[ -e /etc/debian_version ]]; then
apt install python3 python3-tk
apt install python3-tk jq
elif [[ -e /etc/fedora-release ]]; then
dnf install python3
dnf install python3-tkinter
dnf install python3-tkinter jq
elif [[ -e /etc/centos-release ]]; then
yum install -y python3
yum install tkinter
yum install -y tkinter epel-release jq
elif [[ -e /etc/arch-release ]]; then
pacman -Syu python3 tk
pacman -Sy tk jq
fi
command -v pip >/dev/null 2>&1 || { sudo -u $USER curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py; sudo -u $USER python3 get-pip.py --no-warn-script-location; rm get-pip.py; }
TAG=$(curl https://api.github.com/repos/ThioJoe/YT-Spammer-Purge/releases/latest -s | jq .name -r)
if [[ $JQ -ne 0 ]]; then
if [[ -e /etc/debian_version ]]; then
apt purge jq
elif [[ -e /etc/fedora-release ]]; then
dnf remove jq
elif [[ -e /etc/centos-release ]]; then
yum remove jq epel-release
elif [[ -e /etc/arch-release ]]; then
pacman -Rs jq
fi
else
echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora, CentOS, Arch Linux system."
exit 1
echo "Did not unistall jq as it was preinstalled before running this script."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Did not uninstall jq..."

fi
sudo -u $USER curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo -u $USER python3 get-pip.py
# Uncomment if running this script alone, to also install the files for YT-Spammer-Purge
sudo -u $USER curl https://codeload.github.com/ThioJoe/YT-Spammer-Purge/tar.gz/refs/tags/v2.6.1 -o yt-spammer.tar.gz
# Uncomment if running this script alone, to also install the files for Youtube-Spammer-Purge
curl https://codeload.github.com/ThioJoe/YT-Spammer-Purge/tar.gz/refs/tags/v${TAG} -o yt-spammer.tar.gz
sudo -u $USER tar -xzf yt-spammer.tar.gz
sudo -u $USER rm yt-spammer.tar.gz
sudo -u $USER cd YT-Spammer-Purge-2.6.1/
sudo -u $USER rm get-pip.py
sudo -u $USER pip install -r requirements.txt
printf "Dependencies and Program installed!\nNow follow these instructions to get a client_secrets.json file!\nhttps://github.com/ThioJoe/YT-Spammer-Purge/wiki/Instructions:-Obtaining-an-API-Key\n"
rm yt-spammer.tar.gz
cd YouTube-Spammer-Purge-${TAG}/
sudo -u $USER bash -c "pip install -r requirements.txt"
printf "Dependencies and Program installed!\nNow follow these instructions to get a client_secrets.json file!\nhttps://github.com/ThioJoe/YouTube-Spammer-Purge#instructions---obtaining-youtube-api-key\n"