Skip to content

Commit

Permalink
[improvement] btsync now pulled from ppa - function fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
JMSDOnline committed May 14, 2016
1 parent 23af85c commit e3385b5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
20 changes: 14 additions & 6 deletions commands/system/packages/installpackage-btsync
Expand Up @@ -14,18 +14,26 @@
# including (via compiler) GPL-licensed code must also be made available
# under the GPL along with build & install instructions.
#
REPOURL="https://github.com/Swizards/QuickBox/raw/master/sources/"
MASTER=$(cat /etc/apache2/master.txt)
BTSYNCIP=$(curl -s http://ipecho.net/plain || curl -s http://ifconfig.me/ip ; echo)
OUTTO="/root/quick-box.log"

function _installBTSync() {
sudo wget -qq "${REPOURL}"btsync.latest.tar.gz .
sudo tar xf btsync.latest.tar.gz -C /home/${MASTER}/
sudo chmod +x /home/${MASTER}/btsync
sudo -u ${MASTER} /home/${MASTER}/btsync --webui.listen ${BTSYNCIP}:8888 >>"${OUTTO}" 2>&1
sudo rm -rf btsync.latest.tar.gz
sudo sh -c 'echo "deb http://linux-packages.getsync.com/btsync/deb btsync non-free" > /etc/apt/sources.list.d/btsync.list'
wget -qO - http://linux-packages.getsync.com/btsync/key.asc | sudo apt-key add - >/dev/null 2>&1
sudo apt-get update >>"${OUTTO}" 2>&1
sudo apt-get install btsync >>"${OUTTO}" 2>&1
cd && mkdir /home/${MASTER}/sync_folder
sudo chown ${MASTER}:btsync /home/${MASTER}/sync_folder
sudo chmod 2775 /home/${MASTER}/sync_folder
sudo usermod -a -G btsync ${MASTER}
sudo sed -i 's/BTSYNC=/BTSYNC=yes/g' /home/${MASTER}/.startup
cd /etc/btsync && { curl -O -s https://raw.githubusercontent.com/Swizards/QuickBox/qb_u_1604/sources/config.json ; cd; }
cd /etc/btsync && { curl -O -s https://raw.githubusercontent.com/Swizards/QuickBox/qb_u_1604/sources/user_config.json ; cd; }
sudo sed -i "s/BTSGUIP/$BTSYNCIP/g" /etc/btsync/config.json
sudo sed -i "s/BTSGUIP/$BTSYNCIP/g" /etc/btsync/user_config.json
sudo service btsync start

}

_installBTSync
8 changes: 3 additions & 5 deletions commands/system/packages/removepackage-btsync
Expand Up @@ -15,14 +15,12 @@
# under the GPL along with build & install instructions.
#
MASTER=$(cat /etc/apache2/master.txt)
OUTTO="/root/quick-box.log"

function _removeBTSync() {
sudo service btsync stop
sudo killall btsync
sudo find / -name ".sync" -type d -exec rm -rf {} \;
sudo find / -name "btsync" -type f -exec rm -rf {} \;
sudo rm /home/${MASTER}/LICENSE.TXT
sudo rm /home/${MASTER}/README
sudo apt-get -y remove --purge btsync btsync-common
sudo apt-get -y remove --purge btsync* >>"${OUTTO}" 2>&1
sudo sed -i 's/BTSYNC=yes/BTSYNC=/g' /home/${MASTER}/.startup
sudo service apache2 reload
}
Expand Down
19 changes: 14 additions & 5 deletions quickbox.sh
Expand Up @@ -1365,11 +1365,20 @@ function _askbtsync() {
case $responce in
[yY] | [yY][Ee][Ss] )
echo -n "Installing BTSync ... "
wget -qq https://github.com/Swizards/QuickBox/raw/master/sources/btsync.latest.tar.gz .
tar xf btsync.latest.tar.gz -C /home/${username}/
chmod +x /home/${username}/btsync
sudo -u ${username} /home/${username}/btsync --webui.listen ${ip}:8888 >>"${OUTTO}" 2>&1
rm -rf btsync.latest.tar.gz
sudo sh -c 'echo "deb http://linux-packages.getsync.com/btsync/deb btsync non-free" > /etc/apt/sources.list.d/btsync.list'
wget -qO - http://linux-packages.getsync.com/btsync/key.asc | sudo apt-key add - >/dev/null 2>&1
sudo apt-get update >>"${OUTTO}" 2>&1
sudo apt-get install btsync >>"${OUTTO}" 2>&1
cd && mkdir /home/${MASTER}/sync_folder
sudo chown ${MASTER}:btsync /home/${MASTER}/sync_folder
sudo chmod 2775 /home/${MASTER}/sync_folder
sudo usermod -a -G btsync ${MASTER}
sudo sed -i 's/BTSYNC=/BTSYNC=yes/g' /home/${MASTER}/.startup
cd /etc/btsync && { curl -O -s https://raw.githubusercontent.com/Swizards/QuickBox/qb_u_1604/sources/config.json ; cd; }
cd /etc/btsync && { curl -O -s https://raw.githubusercontent.com/Swizards/QuickBox/qb_u_1604/sources/user_config.json ; cd; }
sudo sed -i "s/BTSGUIP/$BTSYNCIP/g" /etc/btsync/config.json
sudo sed -i "s/BTSGUIP/$BTSYNCIP/g" /etc/btsync/user_config.json
sudo service btsync start
echo "${OK}"
;;
[nN] | [nN][Oo] | "") echo "${cyan}Skipping BTSync install${normal} ... " ;;
Expand Down

0 comments on commit e3385b5

Please sign in to comment.