run temp instance of sabnzbd to generate config file
This commit is contained in:
+33
-25
@@ -28,13 +28,21 @@ with lib; let
|
|||||||
}:
|
}:
|
||||||
pkgs.writeShellApplication {
|
pkgs.writeShellApplication {
|
||||||
name = "set-sabnzbd-ini-values";
|
name = "set-sabnzbd-ini-values";
|
||||||
runtimeInputs = with pkgs; [initool];
|
runtimeInputs = with pkgs; [initool sabnzbd sudo coreutils];
|
||||||
text = with lib.strings; (
|
text = with lib.strings; (
|
||||||
# set download dirs
|
# set download dirs
|
||||||
''
|
''
|
||||||
if [ ! -f ${sabnzbd-state-dir}/sabnzbd.ini ]; then
|
if [ ! -f ${sabnzbd-state-dir}/sabnzbd.ini ]; then
|
||||||
exit 0
|
sudo -u usenet -g media sabnzbd -p -d -f ${sabnzbd-state-dir}/sabnzbd.ini
|
||||||
fi
|
sab_pid=$!
|
||||||
|
|
||||||
|
until [ -f "${sabnzbd-state-dir}/sabnzbd.ini" ]
|
||||||
|
do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
kill -INT $sab_pid
|
||||||
|
fi
|
||||||
|
|
||||||
initool set ${sabnzbd-state-dir}/sabnzbd.ini "" __comment__ '${edited-flag}' \
|
initool set ${sabnzbd-state-dir}/sabnzbd.ini "" __comment__ '${edited-flag}' \
|
||||||
| initool set - misc download_dir "${nixarr.mediaDir}/usenet/.incomplete" \
|
| initool set - misc download_dir "${nixarr.mediaDir}/usenet/.incomplete" \
|
||||||
@@ -169,28 +177,28 @@ in {
|
|||||||
)
|
)
|
||||||
];
|
];
|
||||||
|
|
||||||
ExecStartPost = mkBefore [
|
# ExecStartPost = mkBefore [
|
||||||
(
|
# (
|
||||||
"+" + pkgs.writeShellApplication {
|
# "+" + pkgs.writeShellApplication {
|
||||||
name = "ensure-sabnzbd-config-edits";
|
# name = "ensure-sabnzbd-config-edits";
|
||||||
runtimeInputs = with pkgs; [initool coreutils systemd];
|
# runtimeInputs = with pkgs; [initool coreutils systemd];
|
||||||
text = ''
|
# text = ''
|
||||||
until [ -f "${cfg.stateDir}/sabnzbd.ini" ]
|
# until [ -f "${cfg.stateDir}/sabnzbd.ini" ]
|
||||||
do
|
# do
|
||||||
sleep 1
|
# sleep 1
|
||||||
done
|
# done
|
||||||
|
#
|
||||||
if ! initool get "${cfg.stateDir}/sabnzbd.ini" "" __comment__; then
|
# if ! initool get "${cfg.stateDir}/sabnzbd.ini" "" __comment__; then
|
||||||
# force sabnzbd.service restart for ExecStartPre to run now
|
# # force sabnzbd.service restart for ExecStartPre to run now
|
||||||
# that sabnzbd.ini has been created by the instance
|
# # that sabnzbd.ini has been created by the instance
|
||||||
systemctl restart -f sabnzbd.service
|
# systemctl restart -f sabnzbd.service
|
||||||
fi
|
# fi
|
||||||
|
#
|
||||||
exit
|
# exit
|
||||||
'';
|
# '';
|
||||||
} + "/bin/ensure-sabnzbd-config-edits"
|
# } + "/bin/ensure-sabnzbd-config-edits"
|
||||||
)
|
# )
|
||||||
];
|
# ];
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
StartLimitInterval = 15;
|
StartLimitInterval = 15;
|
||||||
StartLimitBurst = 5;
|
StartLimitBurst = 5;
|
||||||
|
|||||||
Reference in New Issue
Block a user