mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-19 14:16:36 +02:00
* Support install on CentOS / RHEL 6.x * Support uninstall on CentOS / RHEL 6.x * Add /usr/local/bin/ to search path when starting init.d service * Fix dmd-2.084.0 deprecation warning: loop index implicitly converted from size_t to int * Update readme based on CentOS 6 / RHEL 6 additional dependencies * Resolve warnings about "bashisms" in init.d script (Issue #349) - fixed here as we are updating the init file already, rather than have multiple PR's
This commit is contained in:
parent
83cc2e419b
commit
c27ff936fb
20
Makefile
20
Makefile
|
@ -31,9 +31,11 @@ MANDIR ?= $(PREFIX)/share/man/man1
|
||||||
DOCFILES = README.md README.Office365.md config LICENSE CHANGELOG.md
|
DOCFILES = README.md README.Office365.md config LICENSE CHANGELOG.md
|
||||||
|
|
||||||
ifneq ("$(wildcard /etc/redhat-release)","")
|
ifneq ("$(wildcard /etc/redhat-release)","")
|
||||||
RHEL = $(shell cat /etc/redhat-release | grep -E "(Red Hat Enterprise Linux Server|CentOS Linux)" | wc -l)
|
RHEL = $(shell cat /etc/redhat-release | grep -E "(Red Hat Enterprise Linux Server|CentOS)" | wc -l)
|
||||||
|
RHEL_VERSION = $(shell rpm --eval "%{centos_ver}")
|
||||||
else
|
else
|
||||||
RHEL = 0
|
RHEL = 0
|
||||||
|
RHEL_VERSION = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SOURCES = \
|
SOURCES = \
|
||||||
|
@ -74,10 +76,17 @@ install.noservice: onedrive onedrive.1
|
||||||
install: all install.noservice
|
install: all install.noservice
|
||||||
for i in $(DOCFILES) ; do install -D -m 644 $$i $(DESTDIR)$(DOCDIR)/$$i ; done
|
for i in $(DOCFILES) ; do install -D -m 644 $$i $(DESTDIR)$(DOCDIR)/$$i ; done
|
||||||
ifeq ($(RHEL),1)
|
ifeq ($(RHEL),1)
|
||||||
|
ifeq ($(RHEL_VERSION),6)
|
||||||
|
mkdir -p $(DESTDIR)/etc/init.d/
|
||||||
|
chown root.root $(DESTDIR)/etc/init.d/
|
||||||
|
install -D init.d/onedrive.init $(DESTDIR)/etc/init.d/onedrive
|
||||||
|
install -D init.d/onedrive_service.sh $(DESTDIR)$(PREFIX)/bin/onedrive_service.sh
|
||||||
|
else
|
||||||
mkdir -p $(DESTDIR)/usr/lib/systemd/system/
|
mkdir -p $(DESTDIR)/usr/lib/systemd/system/
|
||||||
chown root.root $(DESTDIR)/usr/lib/systemd/system/
|
chown root.root $(DESTDIR)/usr/lib/systemd/system/
|
||||||
chmod 0755 $(DESTDIR)/usr/lib/systemd/system/
|
chmod 0755 $(DESTDIR)/usr/lib/systemd/system/
|
||||||
install -D -m 644 *.service $(DESTDIR)/usr/lib/systemd/system/
|
install -D -m 644 *.service $(DESTDIR)/usr/lib/systemd/system/
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
mkdir -p $(DESTDIR)/usr/lib/systemd/user/
|
mkdir -p $(DESTDIR)/usr/lib/systemd/user/
|
||||||
chown root.root $(DESTDIR)/usr/lib/systemd/user/
|
chown root.root $(DESTDIR)/usr/lib/systemd/user/
|
||||||
|
@ -87,8 +96,8 @@ else
|
||||||
chown root.root $(DESTDIR)/usr/lib/systemd/system/
|
chown root.root $(DESTDIR)/usr/lib/systemd/system/
|
||||||
chmod 0755 $(DESTDIR)/usr/lib/systemd/system/
|
chmod 0755 $(DESTDIR)/usr/lib/systemd/system/
|
||||||
install -D -m 644 onedrive@.service $(DESTDIR)/usr/lib/systemd/system/
|
install -D -m 644 onedrive@.service $(DESTDIR)/usr/lib/systemd/system/
|
||||||
endif
|
|
||||||
install -D -m 644 onedrive.service $(DESTDIR)/usr/lib/systemd/user/onedrive.service
|
install -D -m 644 onedrive.service $(DESTDIR)/usr/lib/systemd/user/onedrive.service
|
||||||
|
endif
|
||||||
|
|
||||||
onedrive.service:
|
onedrive.service:
|
||||||
sed "s|@PREFIX@|$(PREFIX)|g" systemd.units/onedrive.service.in > onedrive.service
|
sed "s|@PREFIX@|$(PREFIX)|g" systemd.units/onedrive.service.in > onedrive.service
|
||||||
|
@ -101,7 +110,12 @@ uninstall:
|
||||||
rm -f $(DESTDIR)$(PREFIX)/bin/onedrive
|
rm -f $(DESTDIR)$(PREFIX)/bin/onedrive
|
||||||
rm -f $(DESTDIR)/etc/logrotate.d/onedrive
|
rm -f $(DESTDIR)/etc/logrotate.d/onedrive
|
||||||
ifeq ($(RHEL),1)
|
ifeq ($(RHEL),1)
|
||||||
|
ifeq ($(RHEL_VERSION),6)
|
||||||
|
rm -f $(DESTDIR)/etc/init.d/onedrive
|
||||||
|
rm -f $(DESTDIR)$(PREFIX)/bin/onedrive_service.sh
|
||||||
|
else
|
||||||
rm -f $(DESTDIR)/usr/lib/systemd/system/onedrive*.service
|
rm -f $(DESTDIR)/usr/lib/systemd/system/onedrive*.service
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
rm -f $(DESTDIR)/usr/lib/systemd/user/onedrive.service
|
rm -f $(DESTDIR)/usr/lib/systemd/user/onedrive.service
|
||||||
rm -f $(DESTDIR)/usr/lib/systemd/system/onedrive@.service
|
rm -f $(DESTDIR)/usr/lib/systemd/system/onedrive@.service
|
||||||
|
@ -110,4 +124,4 @@ endif
|
||||||
rm -f $(DESTDIR)$(MANDIR)/onedrive.1
|
rm -f $(DESTDIR)$(MANDIR)/onedrive.1
|
||||||
|
|
||||||
version: .git/HEAD .git/index
|
version: .git/HEAD .git/index
|
||||||
echo $(shell git describe --tags) >version
|
echo $(shell git describe --tags) > version
|
||||||
|
|
13
README.md
13
README.md
|
@ -17,7 +17,7 @@ A complete tool to interact with OneDrive on Linux. Built following the UNIX phi
|
||||||
## Build Requirements
|
## Build Requirements
|
||||||
* Build environment must have at least 1GB of memory & 1GB swap space
|
* Build environment must have at least 1GB of memory & 1GB swap space
|
||||||
* [libcurl](http://curl.haxx.se/libcurl/)
|
* [libcurl](http://curl.haxx.se/libcurl/)
|
||||||
* [SQLite 3](https://www.sqlite.org/)
|
* [SQLite 3](https://www.sqlite.org/) >= 3.7.15
|
||||||
* [Digital Mars D Compiler (DMD)](http://dlang.org/download.html)
|
* [Digital Mars D Compiler (DMD)](http://dlang.org/download.html)
|
||||||
|
|
||||||
### Dependencies: Ubuntu/Debian - x86_64
|
### Dependencies: Ubuntu/Debian - x86_64
|
||||||
|
@ -82,6 +82,17 @@ For notifications the following is necessary:
|
||||||
sudo yum install libnotify-devel
|
sudo yum install libnotify-devel
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Dependencies: CentOS 6.x / RHEL 6.x
|
||||||
|
In addition to the above requirements, the `sqlite` version used on CentOS 6.x / RHEL 6.x needs to be upgraded. Use the following instructions to update your version of `sqlite` so that it can support the client:
|
||||||
|
```text
|
||||||
|
sudo yum -y update
|
||||||
|
sudo yum -y install epel-release, wget
|
||||||
|
sudo yum -y install mock
|
||||||
|
wget https://kojipkgs.fedoraproject.org//packages/sqlite/3.7.15.2/2.fc19/src/sqlite-3.7.15.2-2.fc19.src.rpm
|
||||||
|
sudo mock --rebuild sqlite-3.7.15.2-2.fc19.src.rpm
|
||||||
|
sudo yum -y upgrade /var/lib/mock/epel-6-{arch}/result/sqlite-*
|
||||||
|
```
|
||||||
|
|
||||||
### Dependencies: Fedora > Version 18
|
### Dependencies: Fedora > Version 18
|
||||||
```text
|
```text
|
||||||
sudo dnf groupinstall 'Development Tools'
|
sudo dnf groupinstall 'Development Tools'
|
||||||
|
|
|
@ -24,7 +24,8 @@ STOP_TIMEOUT=${STOP_TIMEOUT-5}
|
||||||
RETVAL=0
|
RETVAL=0
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
echo -n $"Starting $APP_NAME: "
|
export PATH=/usr/local/bin/:$PATH
|
||||||
|
echo -n "Starting $APP_NAME: "
|
||||||
daemon --user root onedrive_service.sh
|
daemon --user root onedrive_service.sh
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
echo
|
||||||
|
@ -34,7 +35,7 @@ start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
echo -n $"Shutting down $APP_NAME: "
|
echo -n "Shutting down $APP_NAME: "
|
||||||
killproc onedrive
|
killproc onedrive
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
echo
|
||||||
|
@ -74,8 +75,8 @@ case "$1" in
|
||||||
rhstatus
|
rhstatus
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo $"Usage: $0 {start|stop|restart|reload|status}"
|
echo "Usage: $0 {start|stop|restart|reload|status}"
|
||||||
exit 2
|
exit 2
|
||||||
esac
|
esac
|
||||||
|
|
||||||
exit $?
|
exit $?
|
||||||
|
|
|
@ -3,6 +3,7 @@ import std.stdio;
|
||||||
import etc.c.sqlite3;
|
import etc.c.sqlite3;
|
||||||
import std.string: fromStringz, toStringz;
|
import std.string: fromStringz, toStringz;
|
||||||
import core.stdc.stdlib;
|
import core.stdc.stdlib;
|
||||||
|
import std.conv;
|
||||||
static import log;
|
static import log;
|
||||||
|
|
||||||
extern (C) immutable(char)* sqlite3_errstr(int); // missing from the std library
|
extern (C) immutable(char)* sqlite3_errstr(int); // missing from the std library
|
||||||
|
@ -176,9 +177,9 @@ struct Statement
|
||||||
// https://www.sqlite.org/c3ref/data_count.html
|
// https://www.sqlite.org/c3ref/data_count.html
|
||||||
int count = sqlite3_data_count(pStmt);
|
int count = sqlite3_data_count(pStmt);
|
||||||
row = new const(char)[][count];
|
row = new const(char)[][count];
|
||||||
foreach (int i, ref column; row) {
|
foreach (size_t i, ref column; row) {
|
||||||
// https://www.sqlite.org/c3ref/column_blob.html
|
// https://www.sqlite.org/c3ref/column_blob.html
|
||||||
column = fromStringz(sqlite3_column_text(pStmt, i));
|
column = fromStringz(sqlite3_column_text(pStmt, to!int(i)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
string errorMessage = ifromStringz(sqlite3_errmsg(sqlite3_db_handle(pStmt)));
|
string errorMessage = ifromStringz(sqlite3_errmsg(sqlite3_db_handle(pStmt)));
|
||||||
|
|
Loading…
Reference in a new issue