From 068c2bc175861d8d35194e6f5b224b183a1fbc55 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Thu, 12 Nov 2026 23:42:26 +0100 Subject: zot: Added rc file --- zot/doinst.sh | 8 ++++++++ zot/rc.zot | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ zot/zot.SlackBuild | 3 ++- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 zot/rc.zot diff --git a/zot/doinst.sh b/zot/doinst.sh index dfef45f..623c2ea 100644 --- a/zot/doinst.sh +++ b/zot/doinst.sh @@ -15,3 +15,11 @@ config() { } config etc/zot/config.yaml.new + +# Keep same perms on rc.zot.new: +if [ -e etc/rc.d/rc.zot ]; then + cp -a etc/rc.d/rc.zot etc/rc.d/rc.zot.new.incoming + cat etc/rc.d/rc.zot.new > etc/rc.d/rc.zot.new.incoming + mv etc/rc.d/rc.zot.new.incoming etc/rc.d/rc.zot.new +fi +config etc/rc.d/rc.zot.new diff --git a/zot/rc.zot b/zot/rc.zot new file mode 100644 index 0000000..ec63fa8 --- /dev/null +++ b/zot/rc.zot @@ -0,0 +1,56 @@ +#!/bin/bash + +PIDFILE=/var/run/zot.pid +LOGFILE=/var/log/zot.log +CONFIG_FILE=/etc/zot/config.yaml + +zot_start() { + if [ -s $PIDFILE ]; then + echo "zot is already running: $(cat $PIDFILE)." + exit 1 + fi + + /usr/bin/zot serve $CONFIG_FILE >> $LOGFILE 2>&1 & + pidof /usr/bin/zot > $PIDFILE +} + +zot_stop() { + if [ -s $PIDFILE ]; then + kill $(cat $PIDFILE) + rm -f $PIDFILE + else + echo "zot is not running." + fi +} + +zot_restart() { + zot_stop + sleep 1 + zot_start +} + +zot_status() { + if [ -s $PIDFILE ]; then + echo "zot is running: $(cat $PIDFILE)." + else + echo "zot is not running." + fi +} + +case "$1" in + 'start') + zot_start + ;; + 'stop') + zot_stop + ;; + 'restart') + zot_restart + ;; + 'status') + zot_status + ;; + *) + echo "usage: $0 start|stop|restart|status" + ;; +esac diff --git a/zot/zot.SlackBuild b/zot/zot.SlackBuild index e8307cc..98adac9 100644 --- a/zot/zot.SlackBuild +++ b/zot/zot.SlackBuild @@ -77,8 +77,9 @@ mkdir -p $PKG/usr/bin strip bin/zot-linux-${BINARY_SUFFIX} mv bin/zot-linux-${BINARY_SUFFIX} $PKG/usr/bin/zot -mkdir -p $PKG/etc/zot +mkdir -p $PKG/etc/zot $PKG/etc/rc.d cp -a examples/config-example.yaml $PKG/etc/zot/config.yaml.new +cp -a $CWD/rc.zot $PKG/etc/rc.d/rc.zot.new mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a \ -- cgit v1.2.3