Skip to content

Commit

Permalink
hack for smooth update of 32-bit version to multiarch
Browse files Browse the repository at this point in the history
  • Loading branch information
belohoub committed Mar 17, 2021
1 parent 47e2e95 commit 60b5519
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 6 deletions.
40 changes: 40 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Build owncloudcmd

The owncloudcmd and libraries for the 64-bit version were build following the command sequence below, the 32-bit version uses the original binaries from the previous builds:

```bash
$ PKG_PATH=PATH_TO_UBSYNC
$ # ARCH_TRIPLET="arm-linux-gnueabihf"
$ ARCH_TRIPLET="aarch64-linux-gnu"
$
$ wget https://github.com/owncloud/client/archive/v2.5.3.zip
$ unzip v2.5.3.zip
$ cd client-2.5.3
$ BUILD_PATH=$( pwd )
$
$ mkdir client-build
$ cd client-build
$
$ cmake -DCMAKE_BUILD_TYPE="release" -DENABLE_GUI="OFF" ..
$ make
$
$ cp -a ${BUILD_PATH}/client-build/bin/owncloudcmd ${PKG_PATH}/Owncloud-Sync/lib/${ARCH_TRIPLET}/bin
$ cp -a ${BUILD_PATH}/client-build/src/csync/libowncloud_csync.so* ${PKG_PATH}/Owncloud-Sync/lib/${ARCH_TRIPLET}/lib/
$ cp -a ${BUILD_PATH}/client-build/src/libsync/libowncloudsync.so* ${PKG_PATH}/Owncloud-Sync/lib/${ARCH_TRIPLET}/lib/
$
```

# Build Package

```bash
$ PKG_PATH=PATH_TO_UBSYNC
$
$ cd ${PKG_PATH}
$ clickable --arch arm64
$ clickable --arch armhf
$
$ # work with the packages ...
$ touch ${PKG_PATH}/build/aarch64-linux-gnu/app/ubsync_0.5_arm64.click
$ touch ${PKG_PATH}/build/build/arm-linux-gnueabihf/app/ubsync_0.5_armhf.click
$
```
Binary file modified Owncloud-Sync/lib/aarch64-linux-gnu/bin/owncloudcmd
Binary file not shown.
Binary file not shown.
Binary file not shown.
32 changes: 28 additions & 4 deletions OwncloudSync/servicecontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ bool ServiceControl::serviceFileInstalled() const
return false;
}
QFile f(QDir::homePath() + "/.config/upstart/" + m_serviceName + ".conf");
return f.exists();
QFile fVer(QDir::homePath() + "/.config/upstart/" + m_serviceName + ".version");

return (f.exists() && fVer.exists());
}

bool ServiceControl::installServiceFile()
Expand All @@ -42,15 +44,30 @@ bool ServiceControl::installServiceFile()
}

QFile f(QDir::homePath() + "/.config/upstart/" + m_serviceName + ".conf");
// version info file was create to support smooth updates for users with
// non-multiarch UBsync version, as paths in the config file changed
// and it must be updated when upgarding to multiarch ...
QFile fVer(QDir::homePath() + "/.config/upstart/" + m_serviceName + ".version");

if (f.exists()) {
qDebug() << "Service file already existing...";
return false;
// test if the app is not too old - to handle with v0.5 and older updates
if (fVer.exists()) {
qDebug() << "Service file already exist...";
return false;
} else {
qDebug() << "OLD service file exist - updating ... ";
}
}

if (!f.open(QFile::WriteOnly | QFile::Truncate)) {
qDebug() << "Cannot create service file";
return false;
}

if (!fVer.open(QFile::WriteOnly | QFile::Truncate)) {
qDebug() << "Cannot create version file";
return false;
}

//QString appDir = qApp->applicationDirPath();
QString appDir = QDir::currentPath();
Expand Down Expand Up @@ -78,6 +95,11 @@ bool ServiceControl::installServiceFile()
//f.write("exec " + appDir.toUtf8() + "/lib/arm-linux-gnueabihf/bin/" + m_serviceName.toUtf8() + "\n");
f.write("exec /opt/click.ubuntu.com/ubsync/current/lib/arm-linux-gnueabihf/bin/" + m_serviceName.toUtf8() + "\n");
f.close();

// Indicate "multiarch" version of this app
fVer.write("# This is *multiarch* version info only, do not remove this file!\n");
fVer.close();

return true;
}

Expand All @@ -88,7 +110,9 @@ bool ServiceControl::removeServiceFile()
return false;
}
QFile f(QDir::homePath() + "/.config/upstart/" + m_serviceName + ".conf");
return f.remove();
QFile fVer(QDir::homePath() + "/.config/upstart/" + m_serviceName + ".version");

return (f.remove() && fVer.remove());
}

bool ServiceControl::serviceRunning() const
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

**This fork needs revision: armhf build completely untested, while the arm64 build is poorly tested**

**This project will be merged back to launchpad, the last version here currently works, but it is for testing only**

# Project presentation

<img src="https://framagit.org/ernesst/UBsync/raw/master/Owncloud-Sync/UBsync.png" width="196">
Expand All @@ -14,6 +16,7 @@ UBsync is a forked of [ownCloud-sync](https://launchpad.net/owncloud-sync) dedic
1. arch detection and paths to owncloudcmd changed in *OwncloudSyncd/owncloudsyncd.cpp*
1. arch detection and paths for libs added to *OwncloudSync/servicecontrol.cpp*
1. included support for owncloud account in ubuntu-touch (up to now, only nextcloud account was used, even those behave equaly from the UBsync point of view)
1. [build instructions](BUILD.md)

# 0.4 Changelog
1. Migrate the source to https://launchpad.net/owncloud-sync
Expand Down
4 changes: 2 additions & 2 deletions manifest.json.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ubsync",
"description": "A tool to synchronise Utouch to your Nextcloud server",
"description": "A tool to synchronise Utouch to your ownCloud/nextCloud server",
"architecture": "@CLICK_ARCH@",
"title": "UBsync",
"hooks": {
Expand All @@ -10,7 +10,7 @@
"desktop": "Owncloud-Sync/UBsync.desktop"
}
},
"version": "0.5",
"version": "0.6-dev",
"maintainer": "Ern st <[email protected]>",
"framework": "ubuntu-sdk-16.04"
}

0 comments on commit 60b5519

Please sign in to comment.