Skip to content

Commit

Permalink
Make package startable
Browse files Browse the repository at this point in the history
  • Loading branch information
mreid-tt committed Nov 8, 2023
1 parent ea00f03 commit bdd3c3a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 5 deletions.
12 changes: 7 additions & 5 deletions spk/owncloud/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ HOMEPAGE = https://owncloud.org/

LICENSE = AGPL

WIZARDS_TEMPLATES_DIR = src/wizard_templates/
WIZARDS_TEMPLATES_DIR = src/wizard_templates
SERVICE_WIZARD_SHARENAME = wizard_data_share
USE_DATA_SHARE_WORKER = yes

SERVICE_USER = auto
SERVICE_SETUP = src/service-setup.sh
STARTABLE = yes

SYSTEM_GROUP = http

# Admin link for in DSM UI
Expand All @@ -39,9 +43,6 @@ ifeq ($(call version_lt, ${TCVERSION}, 7.0),1)
CONF_DIR = src/conf_6/
endif

SERVICE_SETUP = src/service-setup.sh
STARTABLE = no

# TMPDIR is used for owncloud built in backup and update
USE_ALTERNATE_TMPDIR = 1

Expand All @@ -51,6 +52,7 @@ include ../../mk/spksrc.spk.mk

.PHONY: owncloud_extra_install
owncloud_extra_install:
install -m 755 -d $(STAGING_DIR)/web
install -m 755 -d $(STAGING_DIR)/bin -d $(STAGING_DIR)/web
install -m 755 src/bin/owncloud-daemon $(STAGING_DIR)/bin/owncloud-daemon
install -m 644 src/web/owncloud.conf $(STAGING_DIR)/web/owncloud.conf
install -m 644 src/web/owncloud.json $(STAGING_DIR)/web/owncloud.json
32 changes: 32 additions & 0 deletions spk/owncloud/src/bin/owncloud-daemon
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

set -e

# ownCloud service setup
WEB_DIR="/var/services/web_packages"
# for backwards compatability
if [ $SYNOPKG_DSM_VERSION_MAJOR -lt 7 ];then
WEB_DIR="/var/services/web"
if [ -z ${SYNOPKG_PKGNAME} ]; then
SYNOPKG_PKGNAME="owncloud"
fi
fi
PHP="/usr/local/bin/php74"
OWNCLOUD="${PHP} ${WEB_DIR}/${SYNOPKG_PKGNAME}/occ background:cron"
HOME_DIR="${SYNOPKG_PKGVAR}"
# for backwards compatability
if [ $SYNOPKG_DSM_VERSION_MAJOR -lt 7 ];then
HOME_DIR="${SYNOPKG_PKGDEST}/var"
fi
SLEEP_TIME="1800"

# Main loop
while true; do
# Update
echo "Updating..."
${OWNCLOUD} >> "${HOME_DIR}/daemon.log" 2>&1

# Wait
echo "Waiting ${SLEEP_TIME} seconds..."
sleep ${SLEEP_TIME}
done
9 changes: 9 additions & 0 deletions spk/owncloud/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ exec_eff_sql() {
return $?
}

service_prestart ()
{
# Replace generic service startup, fork process in background
echo "Starting owncloud-daemon at ${SYNOPKG_PKGDEST}/bin" >> ${LOG_FILE}
COMMAND="${SYNOPKG_PKGDEST}/bin/owncloud-daemon"
${COMMAND} >> ${LOG_FILE} 2>&1 &
echo "$!" > "${PID_FILE}"
}

setup_owncloud_instance()
{
if [ "${SYNOPKG_PKG_STATUS}" = "INSTALL" ]; then
Expand Down

0 comments on commit bdd3c3a

Please # to comment.