Closed kouze closed 5 months ago
Just had a look at this issue.
The problem is: the QPKG installer is overwriting the existing nzbget.conf
file with the one contained within the new QPKG (this is normal behaviour for QPKGs). nzbget.conf
really needs to be saved elsewhere, like a config
path, and then that file specified when launching the daemon.
I'll see if I can throw something together to work around this.
Here's the shortest thing I could think-of without modifying the build script. The original nzbget.conf
file is included in the QPKG, but, on first run of the service-script, is copied to nzbget.conf.qnap
, thereafter, the .qnap
file is used by the daemon:
#!/bin/sh
CONF=/etc/config/qpkg.conf
QPKG_NAME="nzbget"
QPKG_ROOT=`/sbin/getcfg $QPKG_NAME Install_Path -f ${CONF}`
APACHE_ROOT=`/sbin/getcfg SHARE_DEF defWeb -d Qweb -f /etc/config/def_share.info`
export QNAP_QPKG=$QPKG_NAME
DEFAULT_CONF_FILE=$QPKG_ROOT/nzbget/nzbget.conf
CONF_FILE=$DEFAULT_CONF_FILE.qnap
[[ -e $CONF_FILE ]] || cp "$DEFAULT_CONF_FILE" "$CONF_FILE"
case "$1" in
start)
ENABLED=$(/sbin/getcfg $QPKG_NAME Enable -u -d FALSE -f $CONF)
if [ "$ENABLED" != "TRUE" ]; then
echo "$QPKG_NAME is disabled."
exit 1
fi
if /bin/pidof nzbget &>/dev/null; then
echo "$QPKG_NAME is already running."
exit 0
fi
cd $QPKG_ROOT/nzbget
$QPKG_ROOT/nzbget/nzbget -c "$CONF_FILE" -D
;;
stop)
$QPKG_ROOT/nzbget/nzbget -c "$CONF_FILE" -Q
for ((i=0; i<=10; i++)); do
/bin/pidof nzbget &>/dev/null || break
sleep 1
done
;;
restart)
$0 stop
$0 start
;;
remove)
;;
*)
echo "Usage: $0 {start|stop|restart|remove}"
exit 1
esac
exit 0
Thoughts please?
Should probably mention: the next QPKG update (even if it includes the mods shown above) will also result in an overwritten nzbget.conf
file. :(
edit: although, I do recall seeing a preinstall function in package_routines
. It might be possible to autosave the existing conf file before this package is installed.
This'll prevent the next QPKG update overwriting the existing nzbget.conf
. package_routines
would need to be modified before the next build:
######################################################################
# Define any package specific operations that shall be performed when
# the package is installed.
######################################################################
pkg_pre_install(){
DEFAULT_CONF_FILE=$SYS_QPKG_INSTALL_PATH/nzbget/nzbget.conf
CONF_FILE=$DEFAULT_CONF_FILE.qnap
[[ ! -e $CONF_FILE && -e $DEFAULT_CONF_FILE ]] && cp "$DEFAULT_CONF_FILE" "$CONF_FILE"
true
}
Okiedoke, so I'll put these in a PR then. 🤓
Is there already an issue for your problem?
NZBGet Version
v24.1-stable
Platform
NAS/Synology/QNAP
Environment
Current Behavior
When upgrading nzbget via package manager in QTS (App Center), the existing configuration of nzbget is getting overwritten by the new version
Expected Behavior
If a configuration already exists, it should not overwrite it
Steps To Reproduce
Logs
No response
Extra information
No response