Skip to content

Commit

Permalink
mass update
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDoobPG authored and MrDoobPG committed Sep 11, 2019
1 parent 372bd39 commit 85960f3
Show file tree
Hide file tree
Showing 13 changed files with 673 additions and 221 deletions.
233 changes: 129 additions & 104 deletions menu/functions/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
# GNU: General Public License v3.0
################################################################################
source /opt/plexguide/menu/functions/functions.sh
fullrel=$(lsb_release -sd)
osname=$(lsb_release -si)
relno=$(lsb_release -sr)
relno=$(printf "%.0f\n" "$relno")
hostname=$(hostname -I | awk '{print $1}')


updateprime() {
abc="/var/plexguide"
Expand Down Expand Up @@ -35,11 +41,10 @@ updateprime() {

file="${abc}/new.install"
if [ ! -e "$file" ]; then newinstall; fi

ospgversion=$(cat /etc/*-release | grep Debian | grep 9)
if [ "$ospgversion" != "" ]; then
echo "debian" >${abc}/os.version
else echo "ubuntu" >${abc}/os.version; fi
nano
if [ "$osname" != "" ]; then
echo "Debian" >${abc}/os.version
else echo "Ubuntu" >${abc}/os.version; fi

echo "3" >${abc}/pg.mergerinstall
echo "52" >${abc}/pg.pythonstart
Expand Down Expand Up @@ -94,14 +99,14 @@ pginstall() {
fi

portainer
pgui
# pgui
core motd &>/dev/null &
core hetzner &>/dev/null &
core gcloud
core cleaner &>/dev/null &
core serverid
core prune
customcontainers &>/dev/null &
# customcontainers &>/dev/null &
pgedition
core mountcheck
emergency
Expand All @@ -119,6 +124,7 @@ core() {
}

############################################################ INSTALLER FUNCTIONS

alias() {
ansible-playbook /opt/plexguide/menu/alias/alias.yml
}
Expand All @@ -130,12 +136,12 @@ aptupdate() {
sed -i 's/false/true/g' /etc/default/sysstat
}

customcontainers() {
mkdir -p /opt/mycontainers
touch /opt/appdata/plexguide/rclone.conf
mkdir -p /opt/communityapps/apps
rclone --config /opt/appdata/plexguide/rclone.conf copy /opt/mycontainers/ /opt/communityapps/apps
}
# customcontainers() {
# mkdir -p /opt/mycontainers
# touch /opt/appdata/plexguide/rclone.conf
# mkdir -p /opt/communityapps/apps
# rclone --config /opt/appdata/plexguide/rclone.conf copy /opt/mycontainers/ /opt/communityapps/apps
# }

cleaner() {
ansible-playbook /opt/plexguide/menu/pg.yml --tags autodelete &>/dev/null &
Expand All @@ -157,12 +163,27 @@ cleaner() {
# when: ansible_distribution == "Ubuntu"

dependency() {
ospgversion=$(cat /var/plexguide/os.version)
if [ "$ospgversion" == "debian" ]; then
ansible-playbook /opt/plexguide/menu/dependency/dependencydeb.yml
else
ansible-playbook /opt/plexguide/menu/dependency/dependency.yml
fi
osname=$(lsb_release -si)
if echo $osname == "Debian" 2>&1 >> /dev/null; then
ansible-playbook (opt/pgstage/roles/dependency/debian-9.yml
elif echo $osname == "Ubuntu" 2>&1 >> /dev/null; then
ansible-playbook (opt/pgstage/roles/dependency/ubtunu-18.04-lts.yml
elif echo $osname == "Rasbian" || "Fedora" || "CentOS"; then

tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⛔ Argggggg ...... System Warning!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Supported: UBUNTU 16.xx - 18.10 ~ LTS/SERVER and Debian 9.* / 10
This server may not be supported due to having the incorrect OS detected!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
sleep 10
fi
}

docstart() {
Expand Down Expand Up @@ -204,10 +225,12 @@ EOF
folders() {
ansible-playbook /opt/plexguide/menu/installer/folders.yml
}

#move to roles
prune() {
ansible-playbook /opt/plexguide/menu/prune/main.yml
}

#move to roles
hetzner() {
if [ -e "$file" ]; then rm -rf /bin/hcloud; fi
Expand All @@ -218,13 +241,15 @@ hetzner() {
rm -rf /opt/appdata/plexguide/hcloud-linux-amd64-$version.tar.gz
rm -rf /opt/appdata/plexguide/hcloud-linux-amd64-$version
}

#move to roles
gcloud() {
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
sudo apt-get update && sudo apt-get install google-cloud-sdk -y
}

#move to roles
mergerinstall() {

Expand All @@ -238,12 +263,12 @@ mergerinstall() {
apt-get remove mergerfs -y
mkdir -p /var/plexguide

if [ "$ub16check" != "" ]; then
if [ "$ub16check" != "" ]; then
activated=true
echo "ub16" >/var/plexguide/mergerfs.version
wget "https://github.com/trapexit/mergerfs/releases/download/2.28.1/mergerfs_2.28.1.ubuntu-xenial_amd64.deb"

elif [ "$ub18check" != "" ]; then
if [ "$ub18check" != "" ]; then
activated=true
echo "ub18" >/var/plexguide/mergerfs.version
wget "https://github.com/trapexit/mergerfs/releases/download/2.28.1/mergerfs_2.28.1.ubuntu-bionic_amd64.deb"
Expand Down Expand Up @@ -308,21 +333,21 @@ mountcheck() {
ansible-playbook /opt/plexguide/menu/pgui/mcdeploy.yml
}

localspace() {
ansible-playbook /opt/pgui/pgui.yml
ansible-playbook /opt/plexguide/menu/pgui/localspace.yml
}
# localspace() {
# ansible-playbook /opt/pgui/pgui.yml
# ansible-playbook /opt/plexguide/menu/pgui/localspace.yml
# }

gtused() {
ansible-playbook /opt/plexguide/menu/pgui/gtused.yml
}
# gtused() {
# ansible-playbook /opt/plexguide/menu/pgui/gtused.yml
# }

crons() {
ansible-playbook /opt/plexguide/menu/pgui/_cron.yml
}
# crons() {
# ansible-playbook /opt/plexguide/menu/pgui/_cron.yml
# }

check() {
ansible-playbook /opt/plexguide/menu/pgui/dynamic.yml
# check() {
# ansible-playbook /opt/plexguide/menu/pgui/dynamic.yml

tee <<-EOF
Expand Down Expand Up @@ -415,81 +440,81 @@ pgui() {
fi
}

pythonstart() {

ansible="2.8.2"
pip="19.1.1"

apt-get install -y --reinstall \
nano \
git \
build-essential \
libssl-dev \
libffi-dev \
python3-dev \
python3-pip \
python-dev \
python-pip
python3 -m pip install --disable-pip-version-check --upgrade --force-reinstall pip==${pip}
python3 -m pip install --disable-pip-version-check --upgrade --force-reinstall setuptools
python3 -m pip install --disable-pip-version-check --upgrade --force-reinstall \
pyOpenSSL \
requests \
netaddr
python -m pip install --disable-pip-version-check --upgrade --force-reinstall pip==${pip}
python -m pip install --disable-pip-version-check --upgrade --force-reinstall setuptools
python -m pip install --disable-pip-version-check --upgrade --force-reinstall ansible==${1-$ansible}

## Copy pip to /usr/bin
cp /usr/local/bin/pip /usr/bin/pip
cp /usr/local/bin/pip3 /usr/bin/pip3

mkdir -p /etc/ansible/inventories/ 1>/dev/null 2>&1
echo "[local]" >/etc/ansible/inventories/local
echo "127.0.0.1 ansible_connection=local" >>/etc/ansible/inventories/local

### Reference: https://docs.ansible.com/ansible/2.4/intro_configuration.html
echo "[defaults]" >/etc/ansible/ansible.cfg
echo "deprecation_warnings=False" >>/etc/ansible/ansible.cfg
echo "command_warnings = False" >>/etc/ansible/ansible.cfg
echo "callback_whitelist = profile_tasks" >>/etc/ansible/ansible.cfg
echo "inventory = /etc/ansible/inventories/local" >>/etc/ansible/ansible.cfg

# Variables Need to Line Up with pg.sh (start)
touch /var/plexguide/background.1
pythonstart() {
ansible-playbook /opt/plexguide/roles/pg.yml --tags python

# ansible="2.8.2"
# pip="19.1.1"

# apt-get install -y --reinstall \
# nano \
# git \
# build-essential \
# libssl-dev \
# libffi-dev \
# python3-dev \
# python3-pip \
# python-dev \
# python-pip
# python3 -m pip install --disable-pip-version-check --upgrade --force-reinstall pip==${pip}
# python3 -m pip install --disable-pip-version-check --upgrade --force-reinstall setuptools
# python3 -m pip install --disable-pip-version-check --upgrade --force-reinstall \
# pyOpenSSL \
# requests \
# netaddr
# python -m pip install --disable-pip-version-check --upgrade --force-reinstall pip==${pip}
# python -m pip install --disable-pip-version-check --upgrade --force-reinstall setuptools
# python -m pip install --disable-pip-version-check --upgrade --force-reinstall ansible==${1-$ansible}

# ## Copy pip to /usr/bin
# cp /usr/local/bin/pip /usr/bin/pip
# cp /usr/local/bin/pip3 /usr/bin/pip3

# mkdir -p /etc/ansible/inventories/ 1>/dev/null 2>&1
# echo "[local]" >/etc/ansible/inventories/local
# echo "127.0.0.1 ansible_connection=local" >>/etc/ansible/inventories/local

# ### Reference: https://docs.ansible.com/ansible/2.4/intro_configuration.html
# echo "[defaults]" >/etc/ansible/ansible.cfg
# echo "deprecation_warnings=False" >>/etc/ansible/ansible.cfg
# echo "command_warnings = False" >>/etc/ansible/ansible.cfg
# echo "callback_whitelist = profile_tasks" >>/etc/ansible/ansible.cfg
# echo "inventory = /etc/ansible/inventories/local" >>/etc/ansible/ansible.cfg

# # Variables Need to Line Up with pg.sh (start)
# touch /var/plexguide/background.1
}
##need fixxes ! For Debian 9/10 && ubu 18.10
dockerinstall() {
ospgversion=$(cat /var/plexguide/os.version)
if [ "$ospgversion" == "debian" ]; then
ansible-playbook /opt/plexguide/menu/pg.yml --tags dockerdeb
else
# if [ "$osname" == "Debian" ]; then
# ansible-playbook /opt/plexguide/menu/pg.yml --tags dockerdeb
# else
ansible-playbook /opt/plexguide/menu/pg.yml --tags docker
# If Docker FAILED, Emergency Install
file="/usr/bin/docker"
if [ ! -e "$file" ]; then
clear
echo "Installing Docker the Old School Way - (Please Be Patient)"
sleep 2
clear
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh
echo ""
echo "Starting Docker (Please Be Patient)"
sleep 2
systemctl start docker
sleep 2
fi

##### Checking Again, if fails again; warns user
file="/usr/bin/docker"
if [ -e "$file" ]; then
sleep 5
else
echo "INFO - FAILED: Docker Failed to Install! Exiting PGBlitz!"
exit
fi
fi
# # If Docker FAILED, Emergency Install
# file="/usr/bin/docker"
# if [ ! -e "$file" ]; then
# clear
# echo "Installing Docker the Old School Way - (Please Be Patient)"
# sleep 2
# clear
# curl -fsSL get.docker.com -o get-docker.sh
# sh get-docker.sh
# echo ""
# echo "Starting Docker (Please Be Patient)"
# sleep 2
# systemctl start docker
# sleep 2
# fi

# ##### Checking Again, if fails again; warns user
# file="/usr/bin/docker"
# if [ -e "$file" ]; then
# sleep 5
# else
# echo "INFO - FAILED: Docker Failed to Install! Exiting PGBlitz!"
# exit
# fi
# fi
}

serverid() {
Expand Down
Loading

0 comments on commit 85960f3

Please sign in to comment.