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 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
62 changes: 44 additions & 18 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,53 @@
#!/bin/bash
command -v jq >/dev/null 2>&1 || { JQ=0; }
#install python
if ! command -v python3 &> /dev/null; then
if [[ -e /etc/debian_version ]]; then
sudo apt install python3
elif [[ -e /etc/fedora-release ]]; then
sudo dnf install python3
elif [[ -e /etc/centos-release ]]; then
sudo yum install -y python3
elif [[ -e /etc/arch-release ]]; then
sudo 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
sudo apt install python3-tk jq
elif [[ -e /etc/fedora-release ]]; then
dnf install python3
dnf install python3-tkinter
sudo dnf install python3-tkinter jq
elif [[ -e /etc/centos-release ]]; then
yum install -y python3
yum install tkinter
sudo yum install -y tkinter epel-release jq
elif [[ -e /etc/arch-release ]]; then
pacman -Sy python3 tk
sudo pacman -Sy tk jq
fi
command -v pip >/dev/null 2>&1 || { curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py; 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.8.0 -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.8.0/'
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"

# 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
tar -xzf yt-spammer.tar.gz
rm yt-spammer.tar.gz
cd YouTube-Spammer-Purge-${TAG}/'
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"
65 changes: 46 additions & 19 deletions install_full.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,53 @@
#!/bin/bash
#install python and tkinter, a dependency
command -v jq >/dev/null 2>&1 || { JQ=0; }
#install python
if ! command -v python3 &> /dev/null; then
if [[ -e /etc/debian_version ]]; then
sudo apt install python3
elif [[ -e /etc/fedora-release ]]; then
sudo dnf install python3
elif [[ -e /etc/centos-release ]]; then
sudo yum install -y python3
elif [[ -e /etc/arch-release ]]; then
sudo 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
sudo apt install python3-tk jq
elif [[ -e /etc/fedora-release ]]; then
dnf install python3
dnf install python3-tkinter
sudo dnf install python3-tkinter jq
elif [[ -e /etc/centos-release ]]; then
yum install -y python3
yum install tkinter
sudo yum install -y tkinter epel-release jq
elif [[ -e /etc/arch-release ]]; then
pacman -Syu python3 tk
sudo pacman -Sy tk jq
fi
command -v pip >/dev/null 2>&1 || { curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py; 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.8.0 -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.8.0/
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"

# 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
tar -xzf yt-spammer.tar.gz
rm yt-spammer.tar.gz
cd YouTube-Spammer-Purge-${TAG}/
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"