Created
October 21, 2016 13:24
-
-
Save 1dot75cm/95ce46b705f6a9a5038d34bacb13209f to your computer and use it in GitHub Desktop.
review.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/rpms/onedrive/0001-ldc2-makefile.patch b/rpms/onedrive/0001-ldc2-makefile.patch | |
index 417b216..e8cfcc0 100644 | |
--- a/rpms/onedrive/0001-ldc2-makefile.patch | |
+++ b/rpms/onedrive/0001-ldc2-makefile.patch | |
@@ -1,18 +1,37 @@ | |
-diff --git a/Makefile b/Makefile | |
-index 006d1a0..425b313 100644 | |
--- a/Makefile | |
+++ b/Makefile | |
-@@ -1,4 +1,4 @@ | |
--DC = dmd | |
-+DC = ldc2 | |
+@@ -1,7 +1,9 @@ | |
+ DC = dmd | |
DFLAGS = -ofonedrive -L-lcurl -L-lsqlite3 -L-ldl | |
- DESTDIR = /usr/local/bin | |
- CONFDIR = /usr/local/etc | |
-diff --git a/onedrive.service b/onedrive.service | |
-index 71db5ae..3e32056 100644 | |
+-DESTDIR = /usr/local/bin | |
+-CONFDIR = /usr/local/etc | |
++DESTDIR = / | |
++PREFIX = /usr/local | |
++CONFDIR = $(DESTDIR)$(PREFIX)/etc | |
++BINDIR = $(DESTDIR)$(PREFIX)/bin | |
+ | |
+ SOURCES = \ | |
+ src/config.d \ | |
+@@ -28,11 +30,11 @@ | |
+ rm -f onedrive.o onedrive | |
+ | |
+ install: onedrive onedrive.conf | |
+- install onedrive $(DESTDIR)/onedrive | |
+- install -m 644 onedrive.conf $(CONFDIR)/onedrive.conf | |
+- install -m 644 onedrive.service /usr/lib/systemd/user | |
++ install -Dm 0755 onedrive $(BINDIR)/onedrive | |
++ install -Dm 0644 onedrive.conf $(CONFDIR)/onedrive.conf | |
++ install -Dm 0644 onedrive.service $(DESTDIR)/usr/lib/systemd/user/onedrive.service | |
+ | |
+ uninstall: | |
+- rm -f $(DESTDIR)/onedrive | |
++ rm -f $(BINDIR)/onedrive | |
+ rm -f $(CONFDIR)/onedrive.conf | |
+- rm -f /usr/lib/systemd/user/onedrive.service | |
++ rm -f $(DESTDIR)/usr/lib/systemd/user/onedrive.service | |
--- a/onedrive.service | |
+++ b/onedrive.service | |
-@@ -3,7 +3,7 @@ Description=OneDrive Free Client | |
+@@ -3,7 +3,7 @@ | |
Documentation=https://github.com/skilion/onedrive | |
[Service] | |
@@ -21,11 +40,9 @@ index 71db5ae..3e32056 100644 | |
Restart=no | |
[Install] | |
-diff --git a/src/onedrive.d b/src/onedrive.d | |
-index 6e57294..f61c892 100644 | |
--- a/src/onedrive.d | |
+++ b/src/onedrive.d | |
-@@ -18,7 +18,7 @@ class OneDriveException: Exception | |
+@@ -18,7 +18,7 @@ | |
// HTTP status code | |
int code; | |
@@ -34,7 +51,7 @@ index 6e57294..f61c892 100644 | |
{ | |
super(msg, file, line, next); | |
} | |
-@@ -266,7 +266,7 @@ final class OneDriveApi | |
+@@ -266,7 +266,7 @@ | |
private auto patch(T)(const(char)[] url, const(T)[] patchData) | |
{ | |
scope(exit) http.clearRequestHeaders(); | |
@@ -43,11 +60,9 @@ index 6e57294..f61c892 100644 | |
http.url = url; | |
addAccessTokenHeader(); | |
auto response = perform(patchData); | |
-diff --git a/src/sync.d b/src/sync.d | |
-index 1789e77..4cd3037 100644 | |
--- a/src/sync.d | |
+++ b/src/sync.d | |
-@@ -33,12 +33,12 @@ private bool testCrc32(string path, const(char)[] crc32) | |
+@@ -33,12 +33,12 @@ | |
class SyncException: Exception | |
{ | |
diff --git a/rpms/onedrive/0002-create-default-config.patch b/rpms/onedrive/0002-create-default-config.patch | |
index 2092467..a7b3021 100644 | |
--- a/rpms/onedrive/0002-create-default-config.patch | |
+++ b/rpms/onedrive/0002-create-default-config.patch | |
@@ -1,5 +1,3 @@ | |
-diff --git a/src/config.d b/src/config.d | |
-index 797c372..173bede 100644 | |
--- a/src/config.d | |
+++ b/src/config.d | |
@@ -1,4 +1,5 @@ | |
@@ -8,7 +6,7 @@ index 797c372..173bede 100644 | |
static import log; | |
final class Config | |
-@@ -24,10 +25,20 @@ final class Config | |
+@@ -24,10 +25,20 @@ | |
void init() | |
{ | |
bool found = false; | |
diff --git a/rpms/onedrive/onedrive.spec b/rpms/onedrive/onedrive.spec | |
index 875a486..051af9b 100644 | |
--- a/rpms/onedrive/onedrive.spec | |
+++ b/rpms/onedrive/onedrive.spec | |
@@ -17,8 +17,9 @@ Patch1: 0001-ldc2-makefile.patch | |
Patch2: 0002-create-default-config.patch | |
BuildRequires: ldc | |
BuildRequires: libcurl-devel | |
-BuildRequires: sqlite-devel | |
- | |
+BuildRequires: sqlite-devel | |
+Requires(post): systemd | |
+Requires(preun): systemd | |
%description | |
Free CLI client for Microsoft OneDrive written in D. | |
@@ -30,20 +31,25 @@ This do not support OneDrive for business. | |
%patch2 -p1 | |
%build | |
-export DFLAGS="%{_d_optflags}" | |
-make %{?_smp_mflags} | |
+%make_build DC="ldc2" | |
%install | |
-%{__mkdir_p} %{buildroot}%{_bindir} | |
-install -Dm 0755 %{name} %{buildroot}%{_bindir}/%{name} | |
+%make_install \ | |
+ PREFIX="%{_prefix}" \ | |
+ CONFDIR="%{buildroot}%{_sysconfdir}" | |
+ | |
+%post | |
+%systemd_user_post %{name}.service | |
-%clean | |
-rm -rf %{buildroot} | |
+%preun | |
+%systemd_user_preun %{name}.service | |
%files | |
%doc README.md | |
%license LICENSE | |
+%config(noreplace) %{_sysconfdir}/%{name}.conf | |
%{_bindir}/%{name} | |
+%{_userunitdir}/%{name}.service | |
%changelog | |
* Thu Oct 20 2016 Ziqian SUN <[email protected]> 1.1-1.giteb8d0fe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment