Skip to content

Commit

Permalink
memcached: fix uninstall on DSM < 7 (#6006)
Browse files Browse the repository at this point in the history
* memcached: fix uninstall on DSM < 7
* limit to DSM version supporting PHP 7.4
  • Loading branch information
hgy59 authored Feb 1, 2024
1 parent 22c8097 commit df14b70
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions spk/memcached/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ DSM_UI_DIR = app

DEPENDS = cross/phpmemcachedadmin cross/memcached

REQUIRED_MIN_DSM = 6.0
SPK_DEPENDS = WebStation:PHP7.4

MAINTAINER = Diaoul
Expand Down
21 changes: 11 additions & 10 deletions spk/memcached/src/service-setup.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@

PATH="${SYNOPKG_PKGDEST}/bin:${PATH}"
CONFIG_DIR="${SYNOPKG_PKGVAR}/phpmemcachedadmin.config"

MEMCACHED="${SYNOPKG_PKGDEST}/bin/memcached"
MEMORY=$(awk '/MemTotal/{memory=$2/1024*0.15; if (memory > 64) memory=64; printf "%0.f", memory}' /proc/meminfo)
SERVICE_COMMAND="${MEMCACHED} -d -m ${MEMORY} -P ${PID_FILE}"


if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 7 ]; then
# for DSM < 7
# for owner of var folder
GROUP=http
WEB_DIR=/var/services/web
fi

PATH="${SYNOPKG_PKGDEST}/bin:${PATH}"
MEMCACHED="${SYNOPKG_PKGDEST}/bin/memcached"
MEMORY=$(awk '/MemTotal/{memory=$2/1024*0.15; if (memory > 64) memory=64; printf "%0.f", memory}' /proc/meminfo)
SERVICE_COMMAND="${MEMCACHED} -d -m ${MEMORY} -P ${PID_FILE}"

service_postinst ()
{
# create config file on demand
if [ ! -e "${SYNOPKG_PKGVAR}/phpmemcachedadmin.config/Memcache.php" ]; then
if [ ! -e ${CONFIG_DIR}/Memcache.php ]; then
echo "Create default config file Memcache.php"
cp -f ${SYNOPKG_PKGVAR}/phpmemcachedadmin.config/Memcache.sample.php ${SYNOPKG_PKGVAR}/phpmemcachedadmin.config/Memcache.php
cp -f ${CONFIG_DIR}/Memcache.sample.php ${CONFIG_DIR}/Memcache.php
fi

if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 7 ]; then

CONFIG_DIR="${SYNOPKG_PKGVAR}/phpmemcachedadmin.config"
WEB_DIR="/var/services/web"

# Install the web interface
cp -R "${SYNOPKG_PKGDEST}/share/phpMemcachedAdmin" ${WEB_DIR}

Expand Down

0 comments on commit df14b70

Please sign in to comment.