User Tools

Site Tools


building_owncloud_client_for_raspberry_pi_232

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

building_owncloud_client_for_raspberry_pi_232 [2018/11/01 20:07] (current)
sgripon created
Line 1: Line 1:
 +====== Building owncloud client for Raspberry pi's raspbian ======
 +~~socialite~~
  
 +I use my Raspberry pi as an owncloud client to synchronize my NAS and my server. Unfortunately, the official package is not up-to-date so I have to build it by myself. 
 +
 +**Update!**: this page has been updated for client 2.3.2. 
 +
 +**DISCLAIMER :!:** Tested on raspbian jessie on raspi 1 and 3. Feedback welcome on twitter.
 +
 +**Note:** if you need a newer version of the client, just tweet me [[https://twitter.com/sgripon|@sgripon]].
 +===== Download binaries =====
 +
 +If you don't want to compile by yourself, you can get the debian package installer from [[http://pub.sgripon.net/owncloud-client/rpi/]] (tested on raspberry pi 1) or [[http://pub.sgripon.net/owncloud-client/rpi3/]] (tested on raspberry pi 3).
 +
 +To install:
 +
 +  sudo dpkg -i owncloud-client-2.3.2_armhf.deb
 +
 +If there are missing dependencies, this command should automatically install all:
 +
 +  sudo apt-get install -f
 +  
 +If not, you should be able to install manually missing packages with apt-get.
 +
 +
 +===== ppa =====
 +
 +I also experiment ppa. You can try it by adding my ppa to the source.list. Add line:
 +
 +  deb http://pub.sgripon.net ppa/
 +  
 +to /etc/apt/sources.list
 +
 +Then:
 +
 +  sudo apt-get update
 +  sudo apt-get install owncloud-client
 +
 +===== Raspberry pi emulator =====
 +
 +I use raspberry pi emulator to build owncloud. See [[raspberry_pi_emulator|Raspberry pi emulator]]. This is to avoid too much writing on SD card and breaking it too quickly.
 +===== Build =====
 +
 +Most of the build instructions are from owncloud official website (http://doc.owncloud.org/desktop/2.2/building.html) with some adjustments for RPI.
 +
 +Get owncloud client sources from official web site here: https://download.owncloud.com/desktop/stable/owncloudclient-2.3.2.tar.xz.
 +
 +This tutorial assumes that the work is done on raspbian in folder /home/pi/dev/owncloud-client. If not, change all paths.
 +
 +On your pi:
 +
 +<code bash>
 +  cd /home/pi/dev/owncloud-client
 +</code>
 +  
 +Some dependencies are necessary to build the two packages.
 +
 +<code bash>
 +  sudo apt-get install libssl-dev
 +  sudo apt-get install libsqlite3-dev
 +  sudo apt-get install libqt4-dev libqtkeychain0 qtkeychain-dev libqt4-sql-sqlite
 +</code>
 +
 +You will need to install cmake if not already done to build both:
 +
 +<code bash>
 +  sudo apt-get install cmake
 +</code>
 +===== Let's build =====
 +
 +The following script downloads and builds the source code (remove download command (//wget//) if already done). The script must be invoked with the desired client version:
 +
 +  ./oc-build.sh 2.3.2
 +  
 +The script should work for future versions unless ownlcoud changes files naming.
 +
 +<file bash oc-build.sh>
 +#!/bin/sh
 +  
 +# Download and extract source from official website
 +if [ ! -f owncloudclient-$1.tar.xz ]; then
 +  wget https://download.owncloud.com/desktop/stable/owncloudclient-$1.tar.xz
 +fi
 +
 +tar -xf owncloudclient-$1.tar.xz
 +
 +# Build
 +mkdir client-build 
 +cd client-build
 +cmake -DWITH_DOC=TRUE -DCMAKE_BUILD_TYPE="Release" ../owncloudclient-$1
 +make
 +
 +</file>
 +
 +Then, installation. The following script must be run as root:
 +
 +<code bash>
 +sudo ./oc-install.sh 2.3.2
 +</code>
 +
 +<file bash oc-install.sh>
 +#!/bin/sh
 +
 +cd client-build
 +
 +# Prepare a redistribuable package
 +make package
 +
 +make install
 +
 +# It seems that libocsync and libowncloudsync shared libraries must be installed manually:
 +cp csync/src/libocsync.so.$1 /usr/local/lib
 +cp src/libsync/libowncloudsync.so.$1 /usr/local/lib
 +ldconfig
 +</file>
 +===== Build a debian package =====
 +
 +In /home/pi/dev/owncloud-client, create a deb folder:
 +
 +  cd /home/pi/dev/owncloud-client
 +  mkdir -p deb/owncloud-client
 +  
 +First thing is to copy all needed files to this new folder. We are lucky, the "make install" command has produced a file with all files installed, so it can be used with rsync:
 +
 +  cd deb/owncloud-client
 +  rsync  --files-from /home/pi/dev/owncloud-client/client-build/install_manifest.txt / .
 +
 +Add also libraries installed manually:
 +
 +  cp /usr/local/lib/libocsync.so.2.3.2 usr/local/lib
 +  cp /usr/local/lib/libowncloudsync.so.2.3.2 usr/local/lib
 +
 +Then, follow tutorial [[How To Build a Debian Package]].
 +
 +The full script to build the debian package:
 +
 +<file bash oc-build-deb.sh>
 +#!/bin/sh
 +
 +DIR=`pwd`
 +
 +mkdir -p deb/owncloud-client
 +cd deb/owncloud-client
 +
 +rsync --files-from $DIR/client-build/install_manifest.txt / .
 +
 +cp /usr/local/lib/libocsync.so.$1 usr/local/lib
 +cp /usr/local/lib/libowncloudsync.so.$1 usr/local/lib
 +
 +mkdir DEBIAN
 +
 +cat <<EOT>> DEBIAN/control
 +Package: owncloud-client
 +Version: $1+debian+rpi1
 +Homepage: https://wiki.sgripon.net/doku.php?id=building_owncloud_client_for_raspberry_pi
 +Depends: libc6 (>= 2.13-28), libgcc1 (>= 1:4.4.0), libqt4-network (>= 4:4.7.0~beta1), libqt4-test (>= 4:4.5.3), libqt4-xml (>= 4:4.5.3), libqtcore4 (>= 4:4.8.0), libqtgui4 (>= 4:4.7.0~beta1), libqtkeychain0 (>= 0.1.0), libstdc++6 (>= 4.4.0), libqtwebkit4, libqt4-xmlpatterns, libqt4-sql-sqlite
 +Priority: optional
 +Section: net
 +Architecture: armhf
 +Essential: no
 +Installed-Size: 1024
 +Maintainer: Sebastien Gripon <oc-rpi-deb@sgripon.net>
 +Description: GUI app to sync a folder to ownCloud
 + Specify one ore more directories on the local machine to sync your ownCloud
 + server, and always have your latest files wherever you are. Make a change to
 + the files on one computer, it will flow across the others using these desktop
 + sync clients.
 +EOT
 +
 +cat <<EOT>> DEBIAN/postinst
 +#!/bin/sh
 +set -e
 + 
 +echo "Postinst running ..."
 +ldconfig
 +echo "Done"
 +EOT
 +
 +chmod 0755 DEBIAN/postinst
 +
 +# Build package
 +cd $DIR/deb
 +dpkg-deb --build owncloud-client
 +
 +# Rename package
 +mv owncloud-client.deb owncloud-client-$1_armhf.deb
 +</file>
 +
 +Must be invoked as sudo with version number as argument:
 +  sudo ./oc-build-deb.sh 2.3.2
 +
 +===== Launch at startup =====
 +
 +If you want to launch owncloud client automatically at startup, just add this line:
 +  
 +  @owncloud
 +
 +at the end of ///etc/xdg/lxsession/LXDE/autostart//
 +
 +Note that owncloud client needs a graphical session to be launched so if you want to launch the client at raspi boot, it must be configured to start X automatically.
 +===== Older Versions =====
 +
 +Older versions can have a different build sequence:
 +  * [[building_owncloud_client_for_raspberry_pi_170|Owncloud client 1.7.0]]
 +
 +**Share this page:**
 +~~socialite~~
building_owncloud_client_for_raspberry_pi_232.txt ยท Last modified: 2018/11/01 20:07 by sgripon