rebase issue #66 (#72)

* Fix systemd service install for builds with DESTDIR defined (#68)

* Update logic --upload-only and --local-first (#71)

* Update the logic handling of --upload-only and --local-first to be more consistent regardless of using --single-directory or not.
This commit is contained in:
abraunegg 2018-07-15 15:30:35 +10:00 committed by GitHub
parent 6567624acb
commit 6fb0cee16d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 20 deletions

View file

@ -27,7 +27,10 @@ install: all
chmod 0775 $(DESTDIR)/var/log/onedrive
install -D onedrive $(DESTDIR)$(PREFIX)/bin/onedrive
install -D -m 644 logrotate/onedrive.logrotate $(DESTDIR)/etc/logrotate.d/onedrive
cp -af *.service $(DESTDIR)/usr/lib/systemd/user/
mkdir -p $(DESTDIR)/usr/lib/systemd/user/
chown root.root $(DESTDIR)/usr/lib/systemd/user/
chmod 0755 $(DESTDIR)/usr/lib/systemd/user/
cp -raf *.service $(DESTDIR)/usr/lib/systemd/user/
chmod 0644 $(DESTDIR)/usr/lib/systemd/user/onedrive*.service
onedrive: version $(SOURCES)

View file

@ -331,33 +331,55 @@ void performSync(SyncEngine sync, string singleDirectory, bool downloadOnly, boo
if (singleDirectory != ""){
// we were requested to sync a single directory
log.vlog("Syncing changes from this selected path: ", singleDirectory);
if (localFirst) {
if (uploadOnly){
log.log("Syncing changes from selected local path only - NOT syncing data changes from OneDrive ...");
sync.scanForDifferences(localPath);
} else {
if (uploadOnly){
// Upload Only of selected single directory
log.log("Syncing changes from selected local path only - NOT syncing data changes from OneDrive ...");
sync.scanForDifferences(localPath);
} else {
// No upload only
if (localFirst) {
// Local First
log.log("Syncing changes from selected local path first before downloading changes from OneDrive ...");
sync.scanForDifferences(localPath);
sync.applyDifferencesSingleDirectory(remotePath);
} else {
// OneDrive First
log.log("Syncing changes from selected OneDrive path ...");
sync.applyDifferencesSingleDirectory(remotePath);
// is this a download only request?
if (!downloadOnly) {
// process local changes
sync.scanForDifferences(localPath);
// ensure that the current remote state is updated locally
sync.applyDifferencesSingleDirectory(remotePath);
}
}
} else {
log.log("Syncing changes from selected OneDrive path first before uploading local changes ...");
sync.applyDifferencesSingleDirectory(remotePath);
sync.scanForDifferences(localPath);
}
} else {
if (!uploadOnly){
// original onedrive client logic below
sync.applyDifferences();
if (!downloadOnly) {
sync.scanForDifferences(localPath);
// ensure that the current state is updated
sync.applyDifferences();
}
} else {
// upload only
// no single directory sync
if (uploadOnly){
// Upload Only of entire sync_dir
log.log("Syncing changes from local path only - NOT syncing data changes from OneDrive ...");
sync.scanForDifferences(localPath);
} else {
// No upload only
if (localFirst) {
// sync local files first before downloading from OneDrive
log.log("Syncing changes from local path first before downloading changes from OneDrive ...");
sync.scanForDifferences(localPath);
sync.applyDifferences();
} else {
// sync from OneDrive first before uploading files to OneDrive
log.log("Syncing changes from OneDrive ...");
sync.applyDifferences();
// is this a download only request?
if (!downloadOnly) {
// process local changes
sync.scanForDifferences(localPath);
// ensure that the current remote state is updated locally
sync.applyDifferences();
}
}
}
}
count = -1;