Skip to content

Commit

Permalink
Merge pull request #29 from TechPerplexed/param
Browse files Browse the repository at this point in the history
Several improvements
  • Loading branch information
TechPerplexed authored Nov 11, 2018
2 parents 6231071 + a94380f commit 9e89f85
Show file tree
Hide file tree
Showing 19 changed files with 218 additions and 179 deletions.
3 changes: 1 addition & 2 deletions install/apps/install-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,10 @@ else
echo ""
cd $CONFIGS/Docker
sudo rsync -a /opt/Gooby/scripts/components/$APPLOC.yaml $CONFIGS/Docker/components
/usr/local/bin/docker-compose down
echo "Just a moment while $APP is being installed..."
[[ ! -f "$TCONFIGS/plexclaim" ]] && echo "-" > $TCONFIGS/plexclaim
source /opt/Gooby/install/misc/environment-build.sh rebuild
/usr/local/bin/docker-compose up -d --remove-orphans ${@:2}
/usr/local/bin/docker-compose up -d --no-deps --build $APP
cd "${CURDIR}"

if [ $APP == organizr ]; then APP=$ORGMENU; fi
Expand Down
67 changes: 40 additions & 27 deletions install/apps/install-rclone.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

source $CONFIGS/Docker/.env
which rclone > $TCONFIGS/checkapp
clear

Expand All @@ -9,7 +10,7 @@ if [ -s $TCONFIGS/checkapp ]; then

echo "Here is a list of the root folders in your mount:"
echo
ls -1 /media/Google
ls -1 ${MOUNTTO}
echo
echo "If you're getting an error here, please"
echo "check your Rclone config settings."
Expand All @@ -24,24 +25,20 @@ else
if [[ ${REPLY} =~ ^[Yy]$ ]]; then

GOAHEAD
RUNPATCHES

# Install MergerFS (for future use)
# Install MergerFS

lsb_release -r -s > /tmp/version
VERSION=$( cat /tmp/version )

if [ "$VERSION" = "18.04" ]; then sudo apt-get -y install mergerfs; fi

rm /tmp/version
which mergerfs > $TCONFIGS/mergerfs
if [ ! -s $TCONFIGS/mergerfs ]; then
sudo wget https://github.com/trapexit/mergerfs/releases/download/2.24.2/mergerfs_2.24.2.ubuntu-xenial_amd64.deb -O /tmp/mergerfs.deb
sudo dpkg -i /tmp/mergerfs.deb
fi
rm /$TCONFIGS/mergerfs

# Main script

cd /tmp
sudo mkdir $TCONFIGS

clear

read -n 1 -s -r -p "Stable ${YELLOW}(S)${STD} or Beta installation ${YELLOW}(B)?${STD} " -i "S" choice

case "$choice" in
Expand All @@ -53,29 +50,45 @@ else

echo "${YELLOW}Please follow the instructions to setup Rclone${STD}"
echo
echo "Make sure you name the config ${YELLOW}Gdrive${STD}"
rclone config
echo
read -r RCLONESERVICE < $HOME/.config/rclone/rclone.conf; RCLONESERVICE=${RCLONESERVICE:1:-1}
read -e -p "Confirm that this is what you named your mount: " -i "$RCLONESERVICE"
echo
read -e -p "What is your media folder in $RCLONESERVICE? (leave empty for root): " -i "" RCLONEFOLDER
echo
sudo rclone config

# Installing Services

sudo mkdir -p /var/local/Gooby/.config
sudo mkdir -p /var/local/.
sudo mkdir -p $HOME/logs
sudo mkdir -p $HOME/Downloads
sudo mkdir -p /media/Google
RCLONESERVICE=${RCLONESERVICE#:}; echo $RCLONESERVICE > $CONFIGS/.config/rcloneservice
RCLONEFOLDER=${RCLONEFOLDER%/}; RCLONEFOLDER=${RCLONEFOLDER#/}; echo $RCLONEFOLDER > $CONFIGS/.config/rclonefolder

sudo rsync -a $HOME/.config/rclone/rclone.conf $CONFIGS/.config
sudo rsync -a /opt/Gooby/scripts/rclone.service /etc/systemd/system/rclone.service
sudo sed -i 's/^#user_allow_other/user_allow_other/g' /etc/fuse.conf

sudo chown -R $USER:$USER $CONFIGS
sudo chown -R $USER:$USER $TCONFIGS
sudo chown -R $USER:$USER $HOME
sudo chown -R $USER:$USER /media/Google
mkdir -p $HOME/logs $HOME/Downloads
sudo mkdir -p ${RCLONEMOUNT} ${MOUNTTO} ${UPLOADS}
sudo chown -R $USER:$USER $HOME $CONFIGS $TCONFIGS $RCLONEMOUNT $MOUNTTO $UPLOADS

sudo systemctl enable rclone.service
if [ ! -d ${UPLOADS}/Downloads ]; then
sudo mv $HOME/Downloads ${UPLOADS}
sudo ln -s ${UPLOADS}/Downloads $HOME/Downloads
fi

sudo rsync -a /opt/Gooby/scripts/services/gooby* /etc/systemd/system/
sudo rsync -a /opt/Gooby/scripts/services/mnt* /etc/systemd/system/
sudo sed -i "s/GOOBYUSER/${USER}/g" /etc/systemd/system/gooby-rclone.service
sudo sed -i "s/GOOBYUSER/${USER}/g" /etc/systemd/system/gooby-find.service

source /opt/Gooby/install/misc/environment-build.sh rebuild

sudo systemctl enable gooby.service gooby-rclone.service gooby-find.service mnt-google.mount
sudo systemctl daemon-reload
sudo systemctl start rclone.service
sudo systemctl start gooby.service

if [ ! -f $TCONFIGS/cronsyncmount ]; then
(crontab -l 2>/dev/null; echo "0,15,30,45 * * * * /opt/Gooby/scripts/cron/syncmount.sh > /dev/null 2>&1") | crontab -
touch $TCONFIGS/cronsyncmount
fi

echo
echo "Done!"
Expand Down
21 changes: 14 additions & 7 deletions install/apps/remove-rclone.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

source $CONFIGS/Docker/.env
which rclone > $TCONFIGS/checkapp
clear

Expand All @@ -17,20 +18,26 @@ else

GOAHEAD

# Close ports

#na

# Main script

/bin/fusermount -uz ${RCLONEMOUNT}
sudo rm /usr/bin/rclone
sudo rm /usr/local/share/man/man1/rclone.1

# Removing Services

sudo systemctl stop rclone.service
sudo systemctl disable rclone.service
sudo rm /etc/systemd/system/rclone.service
if [ -e /etc/systemd/system/rclone.service ]; then
sudo systemctl stop rclone.service
sudo systemctl disable rclone.service
sudo rm /etc/systemd/system/rclone.service
fi

if [ -e /etc/systemd/system/gooby.service ]; then
sudo systemctl stop gooby.service gooby-rclone.service gooby-find.service mnt-google.mount
sudo systemctl disable gooby.service gooby-rclone.service gooby-find.service mnt-google.mount
sudo rm /etc/systemd/system/gooby* /etc/systemd/system/mnt-*
fi

sudo systemctl daemon-reload

TASKCOMPLETE
Expand Down
33 changes: 25 additions & 8 deletions install/apps/update-rclone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ else
GOAHEAD

cd /tmp

if [ -e /etc/systemd/system/gooby.service ]; then sudo systemctl stop gooby.service; fi
clear

echo "You currently have the $( cat $TCONFIGS/rclonev ) version of $TASK installed"
Expand All @@ -27,20 +27,37 @@ else
read -n 1 -s -r -p "Stable ${YELLOW}(S)${STD} or Beta installation ${YELLOW}(B)?${STD} " -i "" choice

case "$choice" in
b|B ) curl https://rclone.org/install.sh | sudo bash -s beta; echo "Beta" > $TCONFIGS/rclonev ;;
s|S ) curl https://rclone.org/install.sh | sudo bash; echo "Stable" > $TCONFIGS/rclonev ;;
* ) echo "No changes made" ;;
b|B ) curl https://rclone.org/install.sh | sudo bash -s beta; echo "Beta" > $TCONFIGS/rclonev ;;
s|S ) curl https://rclone.org/install.sh | sudo bash; echo "Stable" > $TCONFIGS/rclonev ;;
* ) if [ $( cat $TCONFIGS/rclonev ) = "Stable" ]; then
curl https://rclone.org/install.sh | sudo bash
elif [ $( cat $TCONFIGS/rclonev ) = "Beta" ]; then
curl https://rclone.org/install.sh | sudo bash -s beta
fi ;;
esac

cd ~

echo
read -e -p "Make any changes to your config? ${YELLOW}(y/N)${STD}? " -i "" choice

case "$choice" in
y|Y ) sudo rclone config; sudo rsync -a $HOME/.config/rclone/rclone.conf $CONFIGS/.config ;;
* ) echo "All done!" ;;
y|Y ) sudo rclone config
echo
read -r RCLONESERVICE < $HOME/.config/rclone/rclone.conf; RCLONESERVICE=${RCLONESERVICE:1:-1}
read -e -p "Confirm that this is what you named your mount: " -i "$RCLONESERVICE"
echo
read -e -p "What is your media folder in $RCLONESERVICE? (leave empty for root): " -i "" RCLONEFOLDER
echo
RCLONESERVICE=${RCLONESERVICE#:}; echo $RCLONESERVICE > $CONFIGS/.config/rcloneservice
RCLONEFOLDER=${RCLONEFOLDER%/}; RCLONEFOLDER=${RCLONEFOLDER#/}; echo $RCLONEFOLDER > $CONFIGS/.config/rclonefolder
source /opt/Gooby/install/misc/environment-build.sh rebuild
;;
* ) echo "All done!" ;;
esac

sudo systemctl daemon-reload
if [ -e /etc/systemd/system/gooby.service ]; then sudo systemctl start gooby.service; fi

cd $CURDIR

TASKCOMPLETE
Expand Down
1 change: 1 addition & 0 deletions install/gooby
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

source /opt/Gooby/menus/variables.sh
[[ -d "/var/local/.gtemp" ]] && sudo mv /var/local/.gtemp /var/local/.Gooby

if [ "$EUID" -ne 0 ]; then

Expand Down
20 changes: 5 additions & 15 deletions install/install.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
#!/bin/bash

sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get update -y
sudo apt-get upgrade -y

sudo apt-get -y install \
git \
fail2ban \
nano \
unzip \
wget \
curl \
ufw \
socat \
fuse \
apt-transport-https \
acl \
ca-certificates \
denyhosts at sudo software-properties-common
for i in git fail2ban nano unzip wget curl ufw socat fuse apt-transport-https acl mergerfs ca-certificates; do
sudo apt-get -y install $i
done

sudo ufw default deny incoming
sudo ufw default allow outgoing
Expand Down
38 changes: 22 additions & 16 deletions install/misc/environment-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

source /opt/Gooby/menus/variables.sh

DOCKERHOME=$CONFIGS/Docker
sudo mkdir -p $DOCKERHOME/components
ENV=${DOCKERHOME}/.env
ENV=$CONFIGS/Docker/.env
touch ${ENV}

# Load existing variables and use them as defaults, if available
Expand Down Expand Up @@ -33,22 +31,30 @@ echo "# Environment variables #" >> ${ENV}
echo "# for Gooby v$VERSION #" >> ${ENV}
echo "###########################" >> ${ENV}
echo >> ${ENV}
echo "HOME=$HOME" >> ${ENV}
echo "CONFIGS=${CONFIGS}" >> ${ENV}
echo "TCONFIGS=${TCONFIGS}" >> ${ENV}
echo "HOMEDIR=$HOME" >> ${ENV}
echo "LOGS=$HOME/logs" >> ${ENV}
echo "USERID=$(id -u)" >> ${ENV}
echo "GROUPID=$(id -g)" >> ${ENV}
echo "USERNAME=$USER" >> ${ENV}
echo "GROUPNAME=$USER" >> ${ENV}
echo "IP=$(curl ifconfig.me)" >> ${ENV}
echo "TIMEZONE=$(cat /etc/timezone)" >> ${ENV}
echo "CONFIGS=$CONFIGS" >> ${ENV}
echo "DOWNLOADS=${HOME}/Downloads" >> ${ENV}
echo "GOOGLE=/media/Google" >> ${ENV}
echo "MYDOMAIN=$(cat $CONFIGS/.config/mydomain)" >> ${ENV}
echo "MYEMAIL=$(cat $CONFIGS/.config/myemail)" >> ${ENV}
echo "MEDIA=/media/Google" >> ${ENV}
echo "TV=/media/Google/TV" >> ${ENV}
echo "MOVIES=/media/Google/Movies" >> ${ENV}
echo "RCLONETARGET=Gdrive" >> ${ENV}
echo "MYDOMAIN=$(cat ${CONFIGS}/.config/mydomain)" >> ${ENV}
echo "MYEMAIL=$(cat ${CONFIGS}/.config/myemail)" >> ${ENV}
echo "ORGMENU=menu" >> ${ENV}
[[ -f "$TCONFIGS/plexclaim" ]] && echo "PLEXCLAIM=$(cat $TCONFIGS/plexclaim)" >> ${ENV}

cat ${CONFIGS}/Docker/components/??-* > ${DOCKERHOME}/docker-compose.yaml
echo "RCLONESERVICE=$(cat ${CONFIGS}/.config/rcloneservice)" >> ${ENV}
echo "RCLONEFOLDER=$(cat ${CONFIGS}/.config/rclonefolder)" >> ${ENV}
echo "RCLONEMOUNT=/mnt/rclone" >> ${ENV}
echo "MOUNTTO=/mnt/google" >> ${ENV}
echo "UPLOADS=/mnt/uploads" >> ${ENV}
echo "GOOGLE=/mnt/google" >> ${ENV}
echo "MEDIA=/mnt/google" >> ${ENV}
echo "MOVIES=/mnt/google/Movies" >> ${ENV}
echo "TV=/mnt/google/TV" >> ${ENV}
echo "DOWNLOADS=${HOMEDIR}/Downloads" >> ${ENV}
[[ -f "${TCONFIGS}/plexclaim" ]] && echo "PLEXCLAIM=$(cat ${TCONFIGS}/plexclaim)" >> ${ENV}

cat ${CONFIGS}/Docker/components/??-* > ${CONFIGS}/Docker/docker-compose.yaml
echo done
2 changes: 0 additions & 2 deletions install/misc/system-cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ if [[ ${REPLY} =~ ^[Yy]$ ]]; then
# Add rlean to bootup cron if not added yet

if [ ! -f $TCONFIGS/cronboot ]; then

(crontab -l 2>/dev/null; echo "@reboot /opt/Gooby/scripts/cron/rclean.sh > /dev/null 2>&1") | crontab -
touch $TCONFIGS/cronboot

fi

source /opt/Gooby/scripts/cron/rclean.sh
Expand Down
4 changes: 3 additions & 1 deletion install/server/server-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ echo ""
echo "${YELLOW}Please answer the following two questions:${STD}"
echo ""
echo "What domain will you be using to access your server?"
read -e -p '(ex: mydomain.com)? ' -i "${MYDOMAIN}" MYDOMAIN
read -e -p '(ex: mydomain.com) ' -i "${MYDOMAIN}" MYDOMAIN
echo ""
echo "What is your email address for certificate registration?"
read -e -p '(ex: [email protected]) ' -i "${MYEMAIL}" MYEMAIL
Expand All @@ -28,4 +28,6 @@ sudo chown -R $USER:$USER $TCONFIGS
echo "$MYDOMAIN" > $CONFIGS/.config/mydomain
echo "$MYEMAIL" > $CONFIGS/.config/myemail
sudo rsync -a /opt/Gooby/scripts/components/{00-AAA.yaml,01-proxy.yaml} $CONFIGS/Docker/components
touch $CONFIGS/.config/rcloneservice $CONFIGS/.config/rclonefolder
source /opt/Gooby/install/misc/environment-build.sh
cd $CONFIGS/Docker; /usr/local/bin/docker-compose up -d --remove-orphans ${@:2}; cd "${CURDIR}"
15 changes: 12 additions & 3 deletions menus/variables.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

VERSION="2.0.3"
VERSION="2.1.0"
CONFIGS=/var/local/Gooby
TCONFIGS=/var/local/.gtemp
TCONFIGS=/var/local/.Gooby
CURDIR=$(pwd)

# Define colors
Expand Down Expand Up @@ -108,10 +108,19 @@ EXPLAINTASK(){

EXPLAINAPP(){
clear
which rclone > $TCONFIGS/checkapp
if [ ! -s $TCONFIGS/checkapp ]; then
echo "${LRED}"
echo "--------------------------------------------------"
echo " WARNING! Rclone is not installed yet."
echo " Please configure that first, otherwise your"
echo " system will not work as intended."
echo "--------------------------------------------------"
echo "${STD}"
fi
echo "${CYAN}"
echo "--------------------------------------------------"
echo " This will ${PERFORM} ${TASK}"
echo " You will have a few seconds of server downtime"
echo "--------------------------------------------------"
echo "${STD}"
}
Expand Down
7 changes: 2 additions & 5 deletions scripts/cron/rclean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ echo

sudo systemctl daemon-reload

if [ -e /etc/systemd/system/mergerfs.service ]; then sudo systemctl stop mergerfs; fi
if [ -e /etc/systemd/system/rclonefs.service ]; then sudo systemctl stop rclonefs; fi
if [ -e /etc/systemd/system/rclone.service ]; then sudo systemctl stop rclone; fi
if [ -e /etc/systemd/system/gooby.service ]; then sudo systemctl stop gooby; fi

echo
echo "${LYELLOW}Making sure components are up to date${STD}"
Expand Down Expand Up @@ -48,10 +47,8 @@ echo
echo "${LYELLOW}Starting services${STD}"
echo

if [ -e /etc/systemd/system/gooby.service ]; then sudo systemctl start gooby; fi
if [ -e /etc/systemd/system/rclone.service ]; then sudo systemctl start rclone; fi
if [ -e /etc/systemd/system/rclonefs.service ]; then sudo systemctl start rclonefs; fi
sleep 10
if [ -e /etc/systemd/system/mergerfs.service ]; then sudo systemctl start mergerfs; fi

echo
echo "${LYELLOW}Pruning old volumes${STD}"
Expand Down
Loading

0 comments on commit 9e89f85

Please sign in to comment.