From 0169e419e0632b907a748aa920e2ed2f2e264e8e Mon Sep 17 00:00:00 2001 From: d2dyno Date: Mon, 5 Nov 2018 19:13:16 -0600 Subject: [PATCH] Massively simplify rclone installation --- .../package/install/installpackage-rclone | 57 +++++++------------ 1 file changed, 19 insertions(+), 38 deletions(-) diff --git a/packages/package/install/installpackage-rclone b/packages/package/install/installpackage-rclone index 5b637354..33b64356 100644 --- a/packages/package/install/installpackage-rclone +++ b/packages/package/install/installpackage-rclone @@ -17,45 +17,23 @@ # including (via compiler) GPL-licensed code must also be made available # under the GPL along with build & install instructions. -local_setup=/etc/QuickBox/setup/ -OUTTO=/srv/rutorrent/home/db/output.log -MASTER=$(cat /srv/rutorrent/home/db/master.txt) -arch=$(arch) +if [[ -f /tmp/.install.lock ]]; then + OUTTO="/root/logs/install.log" +elif [[ -f /install/.panel.lock ]]; then + OUTTO="/srv/panel/db/output.log" +else + OUTTO="/dev/null" +fi +MASTER=$(cat /root/.master.info | cut -d: -f1) -echo "Downloading rclone ... " >>"${OUTTO}" 2>&1; +echo "Downloading and installing rclone ..." >>"${OUTTO}" 2>&1; -if [[ $arch == x86_64 ]]; then - cd /tmp - curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip - unzip rclone-* - cd rclone-*-linux-amd64 - cp rclone /usr/sbin/ - chown root:root /usr/sbin/rclone - chmod 755 /usr/sbin/rclone - ln -s /usr/sbin/rclone /usr/bin/rclone - sudo mkdir -p /usr/local/share/man/man1 - sudo cp rclone.1 /usr/local/share/man/man1/ - sudo mandb - cd /tmp - rm -rf rclone-* -fi -if [[ $arch == i386 ]]; then - cd /tmp - curl -O https://downloads.rclone.org/rclone-current-linux-386.zip - unzip rclone-* - cd rclone-*-linux-386 - cp rclone /usr/sbin/ - chown root:root /usr/sbin/rclone - chmod 755 /usr/sbin/rclone - ln -s /usr/sbin/rclone /usr/bin/rclone - sudo mkdir -p /usr/local/share/man/man1 - sudo cp rclone.1 /usr/local/share/man/man1/ - sudo mandb - cd /tmp - rm -rf rclone-* -fi +# One-liner to check arch/os type, as well as download latest rclone for relevant system. +curl https://rclone.org/install.sh | sudo bash -echo "Installing rclone ... " >>"${OUTTO}" 2>&1; +# Make sure rclone downloads and installs without error before proceeding +if [ $? -eq 0 ]; then + echo "Adding rclone mount service..." >>"${OUTTO}" 2>&1; cat >/etc/systemd/system/rclone@.service<>"${OUTTO}" 2>&1; + touch /install/.rclone.lock + echo "rclone installation complete!" >>"${OUTTO}" 2>&1; +else + echo "Issue occured during rclone installation." >>"${OUTTO}" 2>&1; +fi echo >>"${OUTTO}" 2>&1; echo >>"${OUTTO}" 2>&1; echo "Close this dialog box to refresh your browser" >>"${OUTTO}" 2>&1;