Posted on Leave a comment

NextCloud Linux Client Build Script

Having been a user of ownCloud for a long while, I decided to jump ship to the fork NextCloud for a few reasons, but the main one is that I never managed to get ownCloud to update itself (with the built-in updater app in the Admin panel) without completely shitting the bed, and as a result having to start from scratch & reupload all my files.

Nextcloud on the other hand has managed a major upgrade without any such problems, and the developers seem to be much more active than the ownCloud devs at present.

The one issue at the moment is that there are no packages for the Linux desktop client – it has to be built from scratch. This isn’t too difficult though, but to make things even easier I’ve thrown together a little bash script to automate the process. It’s tested to work under the latest version of Linux Mint (18.1), and does use a couple of commands that sudo won’t allow, so has to be run as root. It’s not polished in any way, but does work fine!

After the build process has completed, the client itself can be run from the Terminal, or made to run at system boot via the Startup Applications Editor in Linux Mint.

#!/bin/bash

echo "This script will compile & install Nextcloud Desktop Sync Client"
echo "Please be patient, this will take a while"

if [[ $EUID -ne 0 ]]; then
   echo "Root commands are used by this script, please run as root user to avoid errors"
   exit 1
fi

echo ""
echo "Installing Build Tools..."
echo ""
apt-get install cmake git-core -y

echo ""
echo "Cloning GitHub Repo..."
echo ""
git clone https://github.com/nextcloud/client_theming.git
cd client_theming
git submodule update --init --recursive

echo ""
echo "Adding Xenial Source Repos to /etc/apt/sources.list..."
echo ""

echo "deb-src http://archive.ubuntu.com/ubuntu/ xenial universe" >> /etc/apt/sources.list
echo "deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates universe" >> /etc/apt/sources.list

echo ""
echo "Updating Apt & installing build dependencies..."
echo ""

apt-get update
apt build-dep owncloud-client -y

echo ""
echo "Compiling NextCloud Client..."
echo ""

mkdir build-linux
cd build-linux
cmake -D OEM_THEME_DIR=`pwd`/../nextcloudtheme ../client
make
make install

echo ""
echo "Adding Custom Library Directory Config..."
echo ""

echo "/usr/local/lib/x86_64-linux-gnu" >> /etc/ld.so.conf.d/x86_64-linux-gnu.conf
ldconfig

echo ""
echo "Nextcloud Client has been built & installed!"
echo ""
exit 0