radicale: add extra command "export_storage" to init script
authorChristian Schoenebeck <redacted>
Sun, 2 Sep 2018 14:52:04 +0000 (16:52 +0200)
committerChristian Schoenebeck <redacted>
Sun, 2 Sep 2018 14:52:04 +0000 (16:52 +0200)
add extra command "export_storage" to export data for use with Radicale 2.x.x
remove myself as PKG_MAINTAINER, give back to the community

Signed-off-by: Christian Schoenebeck <redacted>
net/radicale/Makefile
net/radicale/files/radicale.init

index 513e0bbac8a121c42b123f993dc9e329866329f3..7f413ae1af15e5d1bfa07e3a8b43526712d7d5d9 100644 (file)
@@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=radicale
 PKG_VERSION:=1.1.6
-PKG_RELEASE:=1
-PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
+PKG_RELEASE:=2
+PKG_MAINTAINER:=
 
 PKG_LICENSE:=GPL-3.0
 PKG_LICENSE_FILES:=COPYING
index 4fb9bbb8a9d6d0a1553d45e57c3f301dfa799320..bb40941bbb82e784b64cc5bc914fb2e59782bb66 100755 (executable)
@@ -4,6 +4,11 @@
 START=80
 STOP=10
 
+EXTRA_COMMANDS="export_storage"
+EXTRA_HELP="   export_storage <PATH>
+       - export the storage into the specified folder
+       - <PATH> can be directly used with the default storage backend of Radicale 2.x.x."
+
 CFGDIR=/var/etc/radicale
 SYSCFG=$CFGDIR/config
 LOGCFG=$CFGDIR/logging
@@ -162,6 +167,30 @@ _set_permission() {
        chgrp -R radicale $DATADIR
 }
 
+export_storage() {
+       # if already running do nothing
+       local _PID=$(eval "$PGREP")
+       kill -1 $_PID 2>/dev/null && {
+               echo "Export failed !!! - Service running !" >&2
+               logger -p user.error -t "radicale[$_PID]" "Export failed !!! - Service running !"
+               return 1
+       }
+
+       [ $# -ne 1 ] || [ ! -d $1 ] && {
+               echo "Export failed !!! Directory not given or does not exist !" >&2
+               logger -p user.error -t "radicale[----]" "Export failed !!! Directory not given or does not exist !"
+               return 1
+       }
+
+       _uci2radicale
+       _set_permission
+
+       chmod 775 $1
+       chgrp radicale $1
+
+       radicale --config=$SYSCFG --export-storage $1/export
+}
+
 boot() {
        # wait a given time (default 10 seconds) before startup
        # to wait for interfaces to come up / not using hotplug events during boot
git clone https://git.99rst.org/PROJECT