Skip to content

Commit

Permalink
fix initialization of SHARE_PATH variable on DSM 7 (#6163)
Browse files Browse the repository at this point in the history
- this is a leftover of shared folder redesign (#5649)
- DSM 7 does not allow to call synohare (Permission denied)
  • Loading branch information
hgy59 authored Jun 29, 2024
1 parent ce10bcd commit c3d98f6
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions mk/spksrc.service.installer.functions
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ TAR="/bin/tar"

INST_ETC="/var/packages/${SYNOPKG_PKGNAME}/etc"
INST_VARIABLES="${INST_ETC}/installer-variables"
# DSM7 only
INST_SHARES="/var/packages/${SYNOPKG_PKGNAME}/shares"

if [ -z "${SYNOPKG_PKGVAR}" ]; then
# define SYNOPKG_PKGVAR for compatibility with DSM7 (replaces former INST_VAR)
Expand Down Expand Up @@ -51,10 +53,20 @@ initialize_variables ()
# this is required for installers without resource worker for file share (SRM 1, DSM 5, DSM 6 old packages)
if [ "$(echo ${SHARE_PATH} | grep ^/)" != "${SHARE_PATH}" ]; then
SHARE_NAME=${SHARE_PATH}
if synoshare --get "${SHARE_NAME}" &> /dev/null; then
SHARE_PATH=$(synoshare --get "${SHARE_NAME}" | awk 'NR==4' | cut -d] -f1 | cut -d[ -f2)
install_log "Path of existing share [${SHARE_NAME}] is [${SHARE_PATH}]"
if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
if synoshare --get "${SHARE_NAME}" &> /dev/null; then
SHARE_PATH=$(synoshare --get "${SHARE_NAME}" | awk 'NR==4' | cut -d] -f1 | cut -d[ -f2)
install_log "Path of existing share [${SHARE_NAME}] is [${SHARE_PATH}]"
fi
else
# synoshare fails on DSM 7 (at least on 7.2.1) with "Permission denied"
# but DSM 7 links package specific shares to the package installation folder
if [ -d ${INST_SHARES}/${SHARE_NAME} ]; then
SHARE_PATH=$(realpath ${INST_SHARES}/${SHARE_NAME})
install_log "Path of existing share [${SHARE_NAME}] is [${SHARE_PATH}]"
fi
fi
if [ ! -d "${SHARE_PATH}" ]; then
install_log "SHARE_NAME is not an existing share [${SHARE_PATH}]."
fi
fi
Expand Down

0 comments on commit c3d98f6

Please sign in to comment.