Skip to content

Commit

Permalink
Transmission: Update to v4.0.2 (SynoCommunity#5616)
Browse files Browse the repository at this point in the history
* Update to Transmission 4.0.2
* Revise UI wizards
* Fix for alternate volume
  • Loading branch information
mreid-tt committed Mar 26, 2023
1 parent 5850586 commit 53126aa
Show file tree
Hide file tree
Showing 10 changed files with 207 additions and 423 deletions.
20 changes: 7 additions & 13 deletions cross/transmission/Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
PKG_NAME = transmission
PKG_VERS = 3.00
PKG_VERS = 4.0.2
PKG_EXT = tar.xz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://github.com/transmission/transmission/releases/download/$(PKG_VERS)
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

DEPENDS = cross/zlib cross/openssl cross/curl cross/libevent
DEPENDS = cross/curl

HOMEPAGE = https://transmissionbt.com
COMMENT = A Fast, Easy, and Free BitTorrent Client
LICENSE = GPLv2/GPLv3

GNU_CONFIGURE = 1
CONFIGURE_ARGS = HAVE_CXX=yes --disable-nls --enable-daemon --enable-utp
# gcc >= 5.1 required
REQUIRED_MIN_DSM = 7.0
UNSUPPORTED_ARCHS = comcerto2k

ifeq ($(findstring $(ARCH), ppc824x ppc853x),$(ARCH))
ifneq (5,$(firstword $(sort $(TCVERSION) 5)))
# toolchains before version 5 require the old linux quota version
# related issue: https://github.com/transmission/transmission/issues/591
ADDITIONAL_CFLAGS = -D_LINUX_QUOTA_VERSION=1
endif
endif
CMAKE_ARGS = -DCMAKE_BUILD_TYPE=RelWithDebInfo ..


include ../../mk/spksrc.cross-cc.mk
include ../../mk/spksrc.cross-cmake.mk
6 changes: 3 additions & 3 deletions cross/transmission/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
transmission-3.00.tar.xz SHA1 fd6bd78cfe5a612b422a49e8193d82df2486a3c4
transmission-3.00.tar.xz SHA256 9144652fe742f7f7dd6657716e378da60b751aaeda8bef8344b3eefc4db255f2
transmission-3.00.tar.xz MD5 a23a32672b83c89b9b61e90408f53d98
transmission-4.0.2.tar.xz SHA1 98fb92b1146f97e00414b27259c5275d038faec9
transmission-4.0.2.tar.xz SHA256 39bf7a104a722805a9dc089cdaaffe33bf90b82230a7ea7f340cae59f00a2ee8
transmission-4.0.2.tar.xz MD5 3e2ffe6cec830dc67abd114da60d4772
13 changes: 0 additions & 13 deletions cross/transmission/patches/001-no-debug.patch

This file was deleted.

9 changes: 5 additions & 4 deletions spk/transmission/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SPK_NAME = transmission
SPK_VERS = 3.00
SPK_REV = 20
SPK_VERS = 4.0.2
SPK_REV = 21
SPK_ICON = src/transmission.png

DEPENDS = cross/$(SPK_NAME)
Expand All @@ -11,15 +11,16 @@ DESCRIPTION_FRE = Transmission est un client BitTorrent simple et rapide. Vous p
DESCRIPTION_SPN = Transmission es un cliente BitTorrent simple y rápido. Puedes controlarlo remotamente mediante su interfaz web o alguna aplicación dedicada.
STARTABLE = yes
DISPLAY_NAME = Transmission
CHANGELOG = "1. Update openssl to 1.1.1n.<br/>2. Deploy dedicated package for DSM7 on comcerto2k (DS414j)."
CHANGELOG = "Update Transmission to v4.0.2."

HOMEPAGE = https://transmissionbt.com
LICENSE = GPLv2/GPLv3

WIZARDS_DIR = src/wizard/

SERVICE_USER = auto
SERVICE_WIZARD_SHARE = wizard_download_dir
SERVICE_WIZARD_SHARE = wizard_download_share
USE_DATA_SHARE_WORKER = yes
SERVICE_SETUP = src/service-setup.sh
SERVICE_PORT = 9091
SERVICE_PORT_TITLE = $(DISPLAY_NAME)
Expand Down
150 changes: 43 additions & 107 deletions spk/transmission/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,119 +14,55 @@ TRANSMISSION="${SYNOPKG_PKGDEST}/bin/transmission-daemon"

SERVICE_COMMAND="${TRANSMISSION} -g ${SYNOPKG_PKGVAR} -x ${PID_FILE} -e ${LOG_FILE}"

validate_preinst ()
{
if [ "${SYNOPKG_PKG_STATUS}" == "INSTALL" ] && [ "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 7 ]; then
# If chosen, they need to exist
if [ -n "${wizard_watch_dir}" ] && [ ! -d "${wizard_watch_dir}" ]; then
echo "Watch directory ${wizard_watch_dir} does not exist."
exit 1
fi
if [ -n "${wizard_incomplete_dir}" ] && [ ! -d "${wizard_incomplete_dir}" ]; then
echo "Incomplete directory ${wizard_incomplete_dir} does not exist."
exit 1
fi
fi

exit 0
}

service_postinst ()
{
if [ "${SYNOPKG_PKG_STATUS}" == "INSTALL" ]; then
# Attempt to create the folders after the user/group/shared folder has been created by the package (DSM7+)
# Let the package manage the "watch" and "incomplete" folders for DSM7
# https://github.com/SynoCommunity/spksrc/issues/4766#issuecomment-899875151
if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -ge 7 ]; then
wizard_watch_dir="${wizard_volume:=/volume1}/${wizard_download_dir:=/downloads}/watch"
wizard_incomplete_dir="${wizard_volume:=/volume1}/${wizard_download_dir:=/downloads}/incomplete"
mkdir -p "${wizard_watch_dir}"
mkdir -p "${wizard_incomplete_dir}"
else
# Set permissions for optional folders for DSM <7
# existance is validated with validate_preinst
set_syno_permissions "${wizard_watch_dir}" "${GROUP}"
set_syno_permissions "${wizard_incomplete_dir}" "${GROUP}"
if [ "${SYNOPKG_PKG_STATUS}" = "INSTALL" ]; then
# Capture wizard variable
TXN_DNLOAD=${wizard_download_dir:=volume1/downloads}
# Check that the path exists, if not use path in package shares
if [ ! -d "${TXN_DNLOAD}" ]; then
TXN_DNLOAD=$(realpath "/var/packages/${SYNOPKG_PKGNAME}/shares/${wizard_download_share}")
fi
TXN_FUNCTS=("complete" "incomplete" "watch")
TXN_FOLDRS=("complete" "incomplete" "watch-transmission")
TXN_PATHS=()

# Edit the configuration according to the wizard
sed -e "s|@download_dir@|${wizard_volume:=/volume1}/${wizard_download_dir:=/downloads}|g" \
-e "s|@username@|${wizard_username:=admin}|g" \
-e "s|@password@|${wizard_password:=admin}|g" \
-i ${CFG_FILE}
if [ -d "${wizard_watch_dir}" ]; then
sed -e "s|@watch_dir_enabled@|true|g" \
-e "s|@watch_dir@|${wizard_watch_dir}|g" \
-i ${CFG_FILE}
else
sed -e "s|@watch_dir_enabled@|false|g" \
-e "/@watch_dir@/d" \
-i ${CFG_FILE}
fi
if [ -d "${wizard_incomplete_dir}" ]; then
sed -e "s|@incomplete_dir_enabled@|true|g" \
-e "s|@incomplete_dir@|${wizard_incomplete_dir}|g" \
-i ${CFG_FILE}
else
sed -e "s|@incomplete_dir_enabled@|false|g" \
-e "/@incomplete_dir@/d" \
-i ${CFG_FILE}
fi
fi
}

service_postupgrade ()
{
if [ -r "${CFG_FILE}" ]; then

# Extract the paths from config file
DOWNLOAD_DIR=$(sed -n 's/.*"download-dir"\s*:\s*"\(.*\)",/\1/p' ${CFG_FILE})
INCOMPLETE_DIR=$(sed -n 's/.*"incomplete-dir"\s*:\s*"\(.*\)",/\1/p' ${CFG_FILE})
WATCH_DIR=$(sed -n 's/.*"watch-dir"\s*:\s*"\(.*\)",/\1/p' ${CFG_FILE})

if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -ge 7 ]; then
# Migrate from DSM6 to DSM7 or update folders on DSM7 when changed in upgrade wizard

NEW_DOWNLOAD_DIR="${wizard_volume:=/volume1}/${wizard_download_dir:=/downloads}"
NEW_INCOMPLETE_DIR="${wizard_volume:=/volume1}/${wizard_download_dir:=/downloads}/incomplete"
NEW_WATCH_DIR="${wizard_volume:=/volume1}/${wizard_download_dir:=/downloads}/watch"
mkdir -p "${NEW_INCOMPLETE_DIR}"
mkdir -p "${NEW_WATCH_DIR}"

# update folders in config file according to the wizard
SETTINGS=$(cat "${CFG_FILE}")
SETTINGS=$(echo "$SETTINGS" | jq '."watch-dir-enabled"=true | ."incomplete-dir-enabled"=true')
SETTINGS=$(echo "$SETTINGS" | jq --arg path ${NEW_DOWNLOAD_DIR} '."download-dir"=$path')
SETTINGS=$(echo "$SETTINGS" | jq --arg path ${NEW_INCOMPLETE_DIR} '."incomplete-dir"=$path')
SETTINGS=$(echo "$SETTINGS" | jq --arg path ${NEW_WATCH_DIR} '."watch-dir"=$path')
echo "${SETTINGS}" > ${CFG_FILE}

# move files when folders are changed
shopt -s dotglob # move hidden folder/files too
if [ -n "${DOWNLOAD_DIR}" ] && [ $(realpath "${DOWNLOAD_DIR}") != $(realpath "${NEW_DOWNLOAD_DIR}") ]; then
# move only files from previous download folder that are created by this package (${EFF_USER})
find "${DOWNLOAD_DIR}" -maxdepth 1 -user ${EFF_USER} -exec mv -nv {} "${NEW_DOWNLOAD_DIR}/" \;
fi
if [ -n "${INCOMPLETE_DIR}" ] && [ $(realpath "${INCOMPLETE_DIR}") != $(realpath "${NEW_INCOMPLETE_DIR}") ]; then
mv -nv "${INCOMPLETE_DIR}/*" "${NEW_INCOMPLETE_DIR}/"
fi
if [ -n "${WATCH_DIR}" ] && [ $(realpath "${WATCH_DIR}") != $(realpath "${NEW_WATCH_DIR}") ]; then
mv -nv "${WATCH_DIR}/*" "${NEW_WATCH_DIR}/"
# Create the managed folders
for item in "${TXN_FOLDRS[@]}"; do
folder="$TXN_DNLOAD/$item"
if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -ge 7 ]; then
mkdir -p "$folder"
else
/bin/su "${EFF_USER}" -s /bin/sh -c "mkdir -p $folder"
set_syno_permissions "$folder" "${GROUP}"
fi
shopt -u dotglob
TXN_PATHS+=("$folder")
done

else

# Apply permissions
if [ -n "${DOWNLOAD_DIR}" ] && [ -d "${DOWNLOAD_DIR}" ]; then
set_syno_permissions "${DOWNLOAD_DIR}" "${GROUP}"
fi
if [ -n "${INCOMPLETE_DIR}" ] && [ -d "${INCOMPLETE_DIR}" ]; then
set_syno_permissions "${INCOMPLETE_DIR}" "${GROUP}"
fi
if [ -n "${WATCH_DIR}" ] && [ -d "${WATCH_DIR}" ]; then
set_syno_permissions "${WATCH_DIR}" "${GROUP}"
# Edit the configuration according to the wizard
sed -e "s|@username@|${wizard_username:=admin}|g" \
-e "s|@password@|${wizard_password:=admin}|g" \
-i "${CFG_FILE}"
i=0
while [ $i -lt ${#TXN_FUNCTS[@]} ]; do
if [ -d "${TXN_PATHS[$i]}" ]; then
if [ "${TXN_FUNCTS[$i]}" = "complete" ]; then
sed -e "s|@download_dir@|${TXN_PATHS[$i]}|g" -i "${CFG_FILE}"
else
sed -e "s|@${TXN_FUNCTS[$i]}_dir_enabled@|true|g" \
-e "s|@${TXN_FUNCTS[$i]}_dir@|${TXN_PATHS[$i]}|g" \
-i "${CFG_FILE}"
fi
else
if [ "${TXN_FUNCTS[$i]}" = "complete" ]; then
sed -e "s|@download_dir@|${TXN_DNLOAD}|g" -i "${CFG_FILE}"
else
sed -e "s|@${TXN_FUNCTS[$i]}_dir_enabled@|false|g" \
-e "/@${TXN_FUNCTS[$i]}_dir@/d" \
-i "${CFG_FILE}"
fi
fi
fi
i=$((i+1))
done
fi
}
91 changes: 0 additions & 91 deletions spk/transmission/src/wizard/7.0/install_uifile

This file was deleted.

60 changes: 0 additions & 60 deletions spk/transmission/src/wizard/7.0/upgrade_uifile

This file was deleted.

0 comments on commit 53126aa

Please sign in to comment.