Skip to content

Commit

Permalink
Remove upgrade wizard
Browse files Browse the repository at this point in the history
  • Loading branch information
mreid-tt committed Mar 16, 2023
1 parent f8c1267 commit d4676e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 106 deletions.
48 changes: 0 additions & 48 deletions spk/transmission/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,51 +62,3 @@ service_postinst ()
done
fi
}

service_postupgrade ()
{
if [ -r "${CFG_FILE}" ]; then
# Extract the paths from config file
DOWNLOAD_DIR=$(sed -nr 's/.*"download-dir"\s*:\s*"(.*)",/\1/p' "${CFG_FILE}")
INCOMPLETE_DIR=$(sed -nr 's/.*"incomplete-dir"\s*:\s*"(.*)",/\1/p' "${CFG_FILE}")
WATCH_DIR=$(sed -nr 's/.*"watch-dir"\s*:\s*"(.*)",/\1/p' "${CFG_FILE}")

# Built new managed folder paths in case of a migration
NEW_DOWNLOAD_DIR="${wizard_volume:=/volume1}/${wizard_download_dir:=downloads}/complete"
NEW_INCOMPLETE_DIR="${wizard_volume:=/volume1}/${wizard_download_dir:=downloads}/incomplete"
NEW_WATCH_DIR="${wizard_volume:=/volume1}/${wizard_download_dir:=downloads}/watch-transmission"
NEW_TXN_FOLDRS=("$NEW_DOWNLOAD_DIR" "$NEW_INCOMPLETE_DIR" "$NEW_WATCH_DIR")

# Attempt to create new managed folders
for folder in "${NEW_TXN_FOLDRS[@]}"; do
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
done

# 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 \( -type f -o \( -type d ! -name "complete" ! -name "incomplete" ! -name "watch" ! -name "watch-transmission" \) \) -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}/"
fi
shopt -u dotglob
fi
}
62 changes: 4 additions & 58 deletions spk/transmission/src/wizard/upgrade_uifile
Original file line number Diff line number Diff line change
@@ -1,60 +1,6 @@
[{
"step_title": "DSM Permissions",
"items": [{
"desc": "Please read <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Permission Management</a> for details."
},
{
"desc": "<strong style='color:red'>NOTE:</strong> The package upgrade will try to update permissions on your folders. If you get permission errors within Transmission, manually set Read/Write permissions on the reported folders using File Station. If you are upgrading to DSM7 and you set a watched or incomplete folder please ensure to update the permission for those folders manually."
},
{
"type": "combobox",
"desc": "Please select a volume to use for the download folder",
"subitems": [
{
"key": "wizard_volume",
"desc": "volume name",
"displayField": "display_name",
"valueField": "volume_path",
"editable": false,
"mode": "remote",
"api_store": {
"api": "SYNO.Core.Storage.Volume",
"method": "list",
"version": 1,
"baseParams": {
"limit": -1,
"offset": 0,
"location": "internal"
},
"root": "volumes",
"idProperty": "volume_path",
"fields": [
"display_name",
"volume_path"
]
},
"validator": {
"fn": "{console.log(arguments);return true;}"
}
}
]
},
{
"type": "textfield",
"desc": "Download shared folder (using the volume chosen above)",
"subitems": [
{
"key": "wizard_download_dir",
"desc": "Download shared folder",
"defaultValue": "downloads",
"validator": {
"allowBlank": false,
"regex": {
"expr": "/^[\\w _-]+$/",
"errorText": "Subdirectories are not supported."
}
}
}
]
}]
"step_title": "DSM Permissions",
"items": [{
"desc": "Please read <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Permission Management</a> for details."
}]
}]

0 comments on commit d4676e6

Please sign in to comment.