diff --git a/APKBUILD b/APKBUILD index d592b46..65eddde 100644 --- a/APKBUILD +++ b/APKBUILD @@ -1,12 +1,13 @@ pkgname="semaphore-bin" pkgver=2.14.12 -pkgrel=4 +pkgrel=5 pkgdesc="Modern UI and powerful API for Ansible, Terraform, OpenTofu, PowerShell and other DevOps tools." url="https://semaphoreui.com" license="MIT" install="$pkgname.pre-install $pkgname.pre-upgrade $pkgname.post-install" arch="x86_64" _arch="amd64" +optdepends="mariadb postgresql" source=" $pkgname-$pkgver.tar.gz::https://github.com/semaphoreui/semaphore/releases/download/v${pkgver}/semaphore_${pkgver}_linux_${_arch}.tar.gz semaphore.initd diff --git a/semaphore.initd b/semaphore.initd index a0ae18a..6ac1902 100644 --- a/semaphore.initd +++ b/semaphore.initd @@ -1,8 +1,40 @@ #!/sbin/openrc-run -name=$RC_SVCNAME +name="semaphore" description="Semaphore Service" -supervisor="supervise-daemon" -command="/usr/bin/semaphore server" -command_args="config /var/lib/semaphore/config.json" +command="/usr/bin/semaphore" +command_args="server --config /var/lib/semaphore/config.json" command_user="semaphore" +pidfile="/run/semaphore.pid" + +depend() { + need net + after firewall +} + +start_pre() { + checkpath -d -m 0755 -o semaphore:semaphore /run + checkpath -d -m 0755 -o semaphore:semaphore /var/log/semaphore +} + +start() { + ebegin "Starting ${RC_SVCNAME}" + start-stop-daemon -v --start \ + -1 /var/log/semaphore/current.log \ + -2 /var/log/semaphore/error.log \ + --user ${command_user} \ + --exec ${command} \ + --pidfile ${pidfile} \ + --make-pidfile \ + --background \ + -- ${command_args} + eend $? +} + +stop() { + ebegin "Stopping ${RC_SVCNAME}" + start-stop-daemon --stop \ + --pidfile ${pidfile} \ + --retry TERM/30/KILL/5 + eend $? +}