ma torrent: use base-dir instead of torrent-dir

This commit is contained in:
makefu 2018-08-06 17:52:48 +02:00
parent 616a7f6be3
commit d3571594e4

View file

@ -8,13 +8,13 @@ let
peer-port = 51412; peer-port = 51412;
web-port = 8112; web-port = 8112;
daemon-port = 58846; daemon-port = 58846;
torrent-dir = config.makefu.dl-dir; base-dir = config.makefu.dl-dir;
in { in {
users.users = { users.users = {
download = { download = {
name = "download"; name = "download";
home = torrent-dir; home = base-dir;
uid = mkDefault (genid "download"); uid = mkDefault (genid "download");
createHome = true; createHome = true;
useDefaultShell = true; useDefaultShell = true;
@ -25,10 +25,12 @@ in {
# todo: race condition, do this after download user has been created # todo: race condition, do this after download user has been created
system.activationScripts."download-dir-chmod" = '' system.activationScripts."download-dir-chmod" = ''
for i in finished watch torrents; do for i in finished watch; do
mkdir -p "${torrent-dir}/$i" if test ! -d $i;then
chown download:download "${torrent-dir}/$i" mkdir -p "${base-dir}/$i"
chmod 770 "${torrent-dir}/$i" chown rtorrent:download "${base-dir}/$i"
chmod 775 "${base-dir}/$i"
fi
done done
''; '';
@ -42,6 +44,7 @@ in {
"nginx" "nginx"
]; ];
}; };
rtorrent.members = [ "download" ];
}; };
krebs.rtorrent = { krebs.rtorrent = {
@ -54,7 +57,8 @@ in {
rutorrent.enable = true; rutorrent.enable = true;
enableXMLRPC = true; enableXMLRPC = true;
listenPort = peer-port; listenPort = peer-port;
workDir = torrent-dir; downloadDir = base-dir + "/finished";
watchDir = base-dir + "/watch";
# dump old torrents into watch folder to have them re-added # dump old torrents into watch folder to have them re-added
}; };