Skip to content

Commit

Permalink
deluge 2 upgrade to python 3.10 fix for DSM7 (follow-up #4153) (#5398)
Browse files Browse the repository at this point in the history
* deluge: Import from PR #4153 with added changes

Co-Authored-by: hgy59 <[email protected]>
Co-Authored-by: Christophe David <[email protected]>

* deluge: Add requirements specific to DSM6 vs DSM7

* deluge: Align boost & libtorrent build options

* deluge: Use master on original rencode source code

* start-stop-status: Allow multiple daemon startup

* deluge: Add rencode requirement file as abi3 compatible

* boost_1.78: Simplify re-using existing env variables

* deluge: permissions changes specific to version < DSM7 only

* deluge: Add french description

* deluge: Add precisions related to permissions DSM6 vs DSM7

* deluge: Fix DESCRIPTION field so it show properly in french

* deluge: Update wizard and service-setup.sh based on sabnzbd

* deluge: Update to latest version of core configuration file

* deluge: Add GeoIP wheel

* deluge: Refining install+upgrade scripts and wizard

* start-stop-status: Revert log keeping

* deluge: Fix DSM6 upgrade

* sabnzbd: Ensure group has write access to shared folder sub-dirs

* deluge: Do not migrate data as too prone to errors

* installer.dsm6: Fix permission testing strings

* deluge: Optimize installation steps

* sabnzbd: Use install vs mkdir to ensure group is properly set

* sabnzbd: Forgot to specify group for DSM>=7 for isntall cmd

Co-authored-by: hgy59 <[email protected]>
Co-authored-by: Christophe David <[email protected]>
  • Loading branch information
3 people authored Aug 31, 2022
1 parent 7f9ccec commit 85a79b1
Show file tree
Hide file tree
Showing 32 changed files with 690 additions and 577 deletions.
16 changes: 10 additions & 6 deletions cross/boost_1.78/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ endif

include ../../mk/spksrc.common.mk

ifeq ($(call version_ge, $(call version_gcc), 7.5),1)
# fix compilation with newer compilers
ADDITIONAL_CXXFLAGS += -D_GLIBCXX_USE_C99_MATH -D_GLIBCXX_HAVE_OBSOLETE_ISNAN -D_GLIBCXX_HAVE_OBSOLETE_ISINF
endif

ifeq ($(findstring $(ARCH),$(64bit_ARCHS)),$(ARCH))
ADDRESS_MODEL = 64
else
Expand All @@ -60,6 +55,15 @@ endif

include ../../mk/spksrc.cross-cc.mk

ifeq ($(call version_ge, ${TC_GCC}, 7.5),1)
# fix compilation with newer compilers
ADDITIONAL_CXXFLAGS += -D_GLIBCXX_USE_C99_MATH
ADDITIONAL_CXXFLAGS += -D_GLIBCXX_HAVE_OBSOLETE_ISNAN
ADDITIONAL_CXXFLAGS += -D_GLIBCXX_HAVE_OBSOLETE_ISINF
else
ADDITIONAL_CXXFLAGS += -std=c++11
endif

.PHONY: boost_configure
boost_configure:
$(RUN) ./bootstrap.sh $(CONFIGURE_ARGS)
Expand All @@ -68,7 +72,7 @@ boost_configure:
boost_compile:
@# Recreate user-config.jam to include python-cc.mk on second run
@rm -rf $(WORK_DIR)/$(PKG_DIR)/user-config.jam
@echo "using gcc : `$(TC_PATH)$(TC_PREFIX)gcc -dumpversion` : $(TC_PATH)$(TC_PREFIX)g++ : <address-model>\"$(ADDRESS_MODEL)\" <cflags>\"$(CFLAGS)\" <cxxflags>\"$(CXXFLAGS)\" <linkflags>\"$(LDFLAGS)\" <link>\"shared\" ; " > $(WORK_DIR)/$(PKG_DIR)/user-config.jam
@echo "using gcc : ${TC_GCC} : ${CXX} : <address-model>\"$(ADDRESS_MODEL)\" <cflags>\"$(CFLAGS)\" <cxxflags>\"$(CXXFLAGS) $(ADDITIONAL_CXXFLAGS)\" <linkflags>\"$(LDFLAGS)\" <link>\"shared\" ; " > $(WORK_DIR)/$(PKG_DIR)/user-config.jam
ifneq ($(strip $(WITH_PYTHON)),)
@echo "using python : $(PYTHON_VERSION) : : $(STAGING_INSTALL_PREFIX)/$(PYTHON_INC_DIR) ;" >> $(WORK_DIR)/$(PKG_DIR)/user-config.jam
endif
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- boost/config/stdlib/libstdcpp3.hpp-orig 2021-12-02 06:47:31.000000000 +0000
+++ boost/config/stdlib/libstdcpp3.hpp 2022-06-19 20:47:46.528930819 +0000
@@ -334,7 +334,6 @@ extern "C" char *gets (char *__s);
// C++0x features in GCC 5.1 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 50100) || !defined(BOOST_LIBSTDCXX11)
-# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
# define BOOST_NO_CXX11_HDR_CODECVT
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
# define BOOST_NO_CXX11_STD_ALIGN
23 changes: 0 additions & 23 deletions cross/deluge/Makefile

This file was deleted.

1 change: 0 additions & 1 deletion cross/deluge/PLIST

This file was deleted.

3 changes: 0 additions & 3 deletions cross/deluge/digests

This file was deleted.

47 changes: 0 additions & 47 deletions cross/libtorrent/Makefile

This file was deleted.

3 changes: 0 additions & 3 deletions cross/libtorrent/PLIST

This file was deleted.

3 changes: 0 additions & 3 deletions cross/libtorrent/digests

This file was deleted.

14 changes: 0 additions & 14 deletions cross/rencode/Makefile

This file was deleted.

Empty file removed cross/rencode/PLIST
Empty file.
3 changes: 0 additions & 3 deletions cross/rencode/digests

This file was deleted.

8 changes: 4 additions & 4 deletions mk/spksrc.service.installer.dsm6
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ set_syno_permissions ()
# Ensure directory resides in /volumeX before setting GROUP permissions
if [ "$(echo ${VOLUME} | cut -c2-7)" = "volume" ]; then
# Set read/write permissions for GROUP for folder and subfolders
if [ ! "$(synoacltool -get \"${DIRNAME}\"| grep \"group:${GROUP}:allow:rwxpdDaARWcC-:fd--\")" ]; then
if [ ! "$(synoacltool -get ""${DIRNAME}"" | grep ""group:${GROUP}:allow:rwxpdDaARWcC-:fd--"")" ]; then
# First Unix permissions, but only if it's in Linux mode
if [ "$(synoacltool -get \"${DIRNAME}\"| grep \"Linux mode\")" ]; then
if [ "$(synoacltool -get ""${DIRNAME}"" | grep -i 'Linux mode')" ]; then
set_unix_permissions "${DIRNAME}"
# If it is linux mode (due to old package) we need to add "administrators"-group,
# otherwise the folder is not accessible from File Station anymore!
Expand All @@ -156,9 +156,9 @@ set_syno_permissions ()

# Walk up the tree and set traverse execute permissions for GROUP up to VOLUME
while [ "${DIRNAME}" != "${VOLUME}" ]; do
if [ ! "$(synoacltool -get \"${DIRNAME}\"| grep \"group:${GROUP}:allow:r.x\")" ]; then
if [ ! "$(synoacltool -get ""${DIRNAME}"" | grep ""group:${GROUP}:allow:r.x"")" ]; then
# Here we also need to make sure the admin can access data via File Station
if [ "$(synoacltool -get \"${DIRNAME}\"| grep \"Linux mode\")" ]; then
if [ "$(synoacltool -get ""${DIRNAME}"" | grep -i 'Linux mode')" ]; then
synoacltool -add "${DIRNAME}" "group:administrators:allow:rwxpdDaARWc--:fd--"
fi
# Add the new group permissions
Expand Down
139 changes: 87 additions & 52 deletions mk/spksrc.service.start-stop-status
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ call_func ()

start_daemon ()
{
declare -i i=0
if [ -z "${SVC_QUIET}" ]; then
if [ -z "${SVC_KEEP_LOG}" ]; then
date > ${LOG_FILE}
Expand All @@ -37,95 +38,129 @@ start_daemon ()
fi
fi
call_func "service_prestart"
if [ -z "${SVC_QUIET}" ]; then
echo "Starting ${DNAME} command ${SERVICE_COMMAND} " >> ${LOG_FILE}
fi
if [ -n "${SERVICE_COMMAND}" ]; then
if [ -n "${SVC_NO_REDIRECT}" ]; then
OUT="/dev/null"
else
OUT="${LOG_FILE}"
for service in "${SERVICE_COMMAND[@]}"
do
let i=i+1
if [ -z "${SVC_QUIET}" ]; then
echo "Starting ${DNAME} command ${service}" >> ${LOG_FILE}
fi
if [ -n "${USER}" -a -n "${SYNOPKG_DSM_VERSION_MAJOR}" -a "$SYNOPKG_DSM_VERSION_MAJOR" -lt 6 ]; then
if [ -z "${SVC_CWD}" ]; then
SVC_CD=""
else
SVC_CD="cd ${SVC_CWD}; "
fi
if [ -n "${SYNOPKG_DSM_VERSION_MAJOR}" ] && [ "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 7 ]; then
SU="su ${EFF_USER} -s"
if [ -n "${service}" ]; then
if [ -n "${SVC_NO_REDIRECT}" ]; then
OUT="/dev/null"
else
SU=""
fi
if [ -z "${SVC_BACKGROUND}" ]; then
$SU /bin/sh -c "${SVC_CD}${SERVICE_COMMAND}" >> ${OUT} 2>&1
else
$SU /bin/sh -c "${SVC_CD}${SERVICE_COMMAND}" >> ${OUT} 2>&1 &
OUT="${LOG_FILE}"
fi
if [ -n "${USER}" -a -n "${SYNOPKG_DSM_VERSION_MAJOR}" -a "$SYNOPKG_DSM_VERSION_MAJOR" -lt 6 ]; then
if [ -z "${SVC_CWD}" ]; then
SVC_CD=""
else
SVC_CD="cd ${SVC_CWD}; "
fi
if [ -n "${SYNOPKG_DSM_VERSION_MAJOR}" ] && [ "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 7 ]; then
SU="su ${EFF_USER} -s"
else
SU=""
fi
if [ -z "${SVC_BACKGROUND}" ]; then
$SU /bin/sh -c "${SVC_CD}${service}" >> ${OUT} 2>&1
else
$SU /bin/sh -c "${SVC_CD}${service}" >> ${OUT} 2>&1 &
fi

else
# DSM 6 user is set by conf/privilege
if [ -n "${SVC_CWD}" ]; then
cd "${SVC_CWD}"
else
# DSM 6 user is set by conf/privilege
if [ -n "${SVC_CWD}" ]; then
cd "${SVC_CWD}"
fi
if [ -z "${SVC_BACKGROUND}" ]; then
${service} >> ${OUT} 2>&1
else
${service} >> ${OUT} 2>&1 &
fi
fi
if [ -z "${SVC_BACKGROUND}" ]; then
${SERVICE_COMMAND} >> ${OUT} 2>&1
if [ -n "${SVC_WRITE_PID}" -a -n "${SVC_BACKGROUND}" -a -n "${PID_FILE}" ]; then
[ $i -eq 1 ] && echo -ne "$!" > ${PID_FILE} || echo -ne " $!" >> ${PID_FILE}
else
${SERVICE_COMMAND} >> ${OUT} 2>&1 &
wait_for_status 0 ${SVC_WAIT_TIMEOUT:=20}
fi
fi
if [ -n "${SVC_WRITE_PID}" -a -n "${SVC_BACKGROUND}" -a -n "${PID_FILE}" ]; then
echo "$!" > "${PID_FILE}"
else
wait_for_status 0 ${SVC_WAIT_TIMEOUT}
fi
fi
done
}

stop_daemon ()
{
if [ -n "${PID_FILE}" -a -r "${PID_FILE}" ]; then
PID=$(cat "${PID_FILE}")
if [ -z "${SVC_QUIET}" ]; then
date >> ${LOG_FILE}
echo "Stopping ${DNAME} service ${PID} " >> ${LOG_FILE}
fi
kill -TERM $PID >> ${LOG_FILE} 2>&1
wait_for_status 1 ${SVC_WAIT_TIMEOUT} || kill -KILL $PID >> ${LOG_FILE} 2>&1
for pid in $(cat "${PID_FILE}")
do
if [ -z "${SVC_QUIET}" ]; then
date >> ${LOG_FILE}
echo "Stopping ${DNAME} service : $(ps -p${pid} -o comm=) (${pid})" >> ${LOG_FILE}
fi
kill -TERM ${pid} >> ${LOG_FILE} 2>&1
wait_for_status 1 ${SVC_WAIT_TIMEOUT:=20} ${pid} || kill -KILL ${pid} >> ${LOG_FILE} 2>&1
done
if [ -f "${PID_FILE}" ]; then
rm -f "${PID_FILE}" > /dev/null
fi
fi
call_func "service_poststop"
}

#------------------------------------------------------
# daemon_status()
# $1: PID to check, if empty use ${PID_FILE}
# status: Keeps track of kill -0 exit status
#
# Return 0 when all pid are OK, else return 1
#------------------------------------------------------
daemon_status ()
{

if [ -n "${PID_FILE}" -a -r "${PID_FILE}" ]; then
if kill -0 $(cat "${PID_FILE}") > /dev/null 2>&1; then
return
status=0
[ -z "${1}" ] && pid_list=$(cat ${PID_FILE} 2>/dev/null) || pid_list=${1}
if [ -n "${pid_list}" ]; then
for pid in ${pid_list}
do
kill -0 ${pid} > /dev/null 2>&1
let status=$status+$?
done
if [ $status -ne 0 ]; then
rm -f "${PID_FILE}" > /dev/null
return 1
else
return 0
fi
rm -f "${PID_FILE}" > /dev/null
else
return 1
fi
return 1
}

#------------------------------------------------------
# wait_for_status()
# $1: expected return from daemon_status() call
# $2: timeout (e.g. number of loop to be done)
# $3: PID to check being passed to daemon_status()
# counter: Number of 1sec iteration to wait until
# the return value from daemon_status()
# match expected value
#
# Wait for a duration of $counter seconds for the
# return value from daemon_status(). If it match
# return 0 else return 1 if wait time is over.
#------------------------------------------------------
wait_for_status ()
{
timeout=$2
# default value: 20 seconds
counter=${timeout:=20}
counter=${2}
counter=${counter:=20}
while [ ${counter} -gt 0 ]; do
daemon_status
daemon_status ${3}
[ $? -eq $1 ] && return
let counter=counter-1
sleep 1
done
return 1
}


case $1 in
start)
if daemon_status; then
Expand Down
2 changes: 0 additions & 2 deletions spk/deluge/BROKEN

This file was deleted.

Loading

0 comments on commit 85a79b1

Please sign in to comment.