aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--community/clsync/APKBUILD14
-rw-r--r--community/clsync/clsync.confd22
-rw-r--r--community/clsync/clsync.initd49
3 files changed, 82 insertions, 3 deletions
diff --git a/community/clsync/APKBUILD b/community/clsync/APKBUILD
index 77746a5d3d..9a9f9b2519 100644
--- a/community/clsync/APKBUILD
+++ b/community/clsync/APKBUILD
@@ -2,16 +2,18 @@
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=clsync
pkgver=0.4.3
-pkgrel=0
+pkgrel=1
pkgdesc="File live sync daemon based on inotify"
url="https://github.com/xaionaro/clsync"
arch="x86 x86_64 aarch64"
license="GPL-3.0-or-later"
depends_dev="glib-dev fts-dev libcap-dev libexecinfo-dev linux-headers musl-dev"
makedepends="$depends_dev autoconf automake file libtool"
-subpackages="$pkgname-doc $pkgname-dev"
+subpackages="$pkgname-openrc $pkgname-doc $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/xaionaro/clsync/archive/v$pkgver.tar.gz
musl-fix.patch
+ $pkgname.initd
+ $pkgname.confd
"
options="!check" # upstream does not provide tests
@@ -43,7 +45,13 @@ build() {
package() {
make DESTDIR="$pkgdir" install
+
+ install -D -m 0755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+ install -D -m 0644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+ install -d -m 0755 "$pkgdir"/etc/$pkgname
}
sha512sums="ab803cc04cd2efd5902ea54ae3f7dc29fd88fc01b70f90112f188b60bb45fe79e255a91df3fa429d0b0f4fb6f67ea453d732a53b4db44d9f85077230d9095e4a clsync-0.4.3.tar.gz
-3302e4d565c6647f27c5e24325a81eaf4789735a944b749a4f5b4372558c65ca4b8acd26eec097d965bc1c811597915c46eed75f697cb930e03a8113e20a1d82 musl-fix.patch"
+3302e4d565c6647f27c5e24325a81eaf4789735a944b749a4f5b4372558c65ca4b8acd26eec097d965bc1c811597915c46eed75f697cb930e03a8113e20a1d82 musl-fix.patch
+230324ec639454e614db886eb52f5c2270aae2c54ef46b62e45dba95440f55d02618fa79dccc73d20ed27012ef083cb45bdb3de8b3c4cc4ef91ba31c0e2f7c69 clsync.initd
+227329c0c13c2db137d6d61905c7133fc7ca0666ceff8c14d043e2811adbe6ef5aae4c876093a4d91ec496646ccacc607c853d2c1c1a53ef6d2a4b4db9209307 clsync.confd"
diff --git a/community/clsync/clsync.confd b/community/clsync/clsync.confd
new file mode 100644
index 0000000000..5ebfc761ad
--- /dev/null
+++ b/community/clsync/clsync.confd
@@ -0,0 +1,22 @@
+# Configuration for /etc/init.d/clsync
+
+# Path of the configuration file. Defaults to name of the init script
+# file/symlink with stripped optional part after the first dot.
+# Set to "/NULL/" if no config file should be read.
+#cfgfile="/etc/clsync/${RC_SVCNAME%%.*}.conf"
+
+# Name of the configuration block in the config file to use.
+# If name of the init script file/symlink contains a dot, then it defaults
+# to the part after the first dot (e.g. clsync.backups -> backups). Otherwise
+# "default" is used as the default block.
+#config_block=
+
+# Path of the file to which redirect clsync's stderr. If not specified, clsync
+# is started with "--output syslog" to log into syslog.
+#error_log=
+
+# The user to start clsync process. Defaults to root.
+#command_user=
+
+# Additional arguments to pass to clsync.
+#command_args=
diff --git a/community/clsync/clsync.initd b/community/clsync/clsync.initd
new file mode 100644
index 0000000000..97b9b50f94
--- /dev/null
+++ b/community/clsync/clsync.initd
@@ -0,0 +1,49 @@
+#!/sbin/openrc-run
+
+: ${name:="$RC_SVCNAME"}
+: ${cfgfile:="/etc/clsync/${RC_SVCNAME%%.*}.conf"}
+
+extra_started_commands="reload resync"
+description_reload="Reread filter rules"
+description_resync="Run full resync"
+
+command="/usr/bin/clsync"
+command_background="yes"
+pidfile="/run/$RC_SVCNAME.pid"
+
+if [ "$cfgfile" != '/NULL/' ]; then
+ required_files="$cfgfile"
+fi
+
+start_pre() {
+ local config_block output
+
+ if grep -q '^background\s*=\s*1' "$cfgfile" 2>/dev/null; then
+ ewarn "$cfgfile shouldn't set background = 1, it will make init script unreliable!"
+ fi
+
+ if [ -z "$config_block" ] && [ "${RC_SVCNAME#*.}" != "$RC_SVCNAME" ]; then
+ config_block=${RC_SVCNAME#*.}
+ fi
+ if [ -z "$output_log$error_log" ]; then
+ output='syslog'
+ fi
+
+ command_args="
+ --config-file $cfgfile
+ ${config_block:+"--config-block $config_block"}
+ ${output:+"--output $output"}
+ $command_args"
+}
+
+reload() {
+ ebegin "Reloading $name filter rules"
+ start-stop-daemon --signal HUP --pidfile $pidfile
+ eend $?
+}
+
+resync() {
+ ebegin "Executing $name full resync"
+ start-stop-daemon --signal 12 --pidfile $pidfile
+ eend $?
+}