diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | mkosi.default | 19 | ||||
-rw-r--r-- | mkosi.nspawn | 15 | ||||
-rwxr-xr-x | mkosi.postinst | 18 | ||||
-rw-r--r-- | mkosi.skeleton/etc/apt/apt.conf.d/20auto-upgrades | 6 | ||||
-rw-r--r-- | mkosi.skeleton/etc/apt/apt.conf.d/50unattended-upgrades | 33 | ||||
l--------- | mkosi.skeleton/etc/systemd/system/multi-user.target.wants/sabnzbd.service | 1 | ||||
-rw-r--r-- | mkosi.skeleton/etc/systemd/system/sabnzbd.service | 16 |
8 files changed, 110 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3dff6a2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# mkosi cache +mkosi.cache/* diff --git a/mkosi.default b/mkosi.default new file mode 100644 index 0000000..3abe598 --- /dev/null +++ b/mkosi.default @@ -0,0 +1,19 @@ +[Distribution] +Distribution=ubuntu +Release=bionic +Repositories=main,universe,multiverse +Mirror=http://no.archive.ubuntu.com + +[Output] +Format=directory +Output=/var/lib/machines/sabnzbd + +[Packages] +WithNetwork=yes +Packages= + unattended-upgrades + software-properties-common + p7zip-full + unrar + unzip + python-cryptography diff --git a/mkosi.nspawn b/mkosi.nspawn new file mode 100644 index 0000000..328e350 --- /dev/null +++ b/mkosi.nspawn @@ -0,0 +1,15 @@ +[Exec] +Hostname=sabnzbd +ResolvConf=copy-host +Timezone=copy +PrivateUsers=false +NoNewPrivilegs=yes + +[Files] +#PrivateUsersChown=yes +Bind=/var/local/sabnzbd:/config +Bind=/srv/data/complete:/downloads +Bind=/srv/data/incomplete:/incomplete-downloads + +[Network] +VirtualEthernet=no diff --git a/mkosi.postinst b/mkosi.postinst new file mode 100755 index 0000000..7e29285 --- /dev/null +++ b/mkosi.postinst @@ -0,0 +1,18 @@ +#!/bin/sh +set -ex + +export DEBIAN_FRONTEND=noninteractive +export HOME="/config" + +groupadd --system --gid 997 warez +useradd --system --gid warez --uid 997 warez + + +add-apt-repository --yes ppa:jcfp/nobetas +add-apt-repository --yes ppa:jcfp/sab-addons +apt install --yes sabnzbdplus python-sabyenc par2-tbb python-pip + +pip install --no-cache-dir apprise chardet pynzb requests sabyenc + +apt purge --auto-remove --yes python-pip +apt clean diff --git a/mkosi.skeleton/etc/apt/apt.conf.d/20auto-upgrades b/mkosi.skeleton/etc/apt/apt.conf.d/20auto-upgrades new file mode 100644 index 0000000..8504436 --- /dev/null +++ b/mkosi.skeleton/etc/apt/apt.conf.d/20auto-upgrades @@ -0,0 +1,6 @@ +APT::Periodic::Unattended-Upgrade "1"; + +APT::Periodic::Update-Package-Lists "1"; + + +APT::Periodic::AutocleanInterval "7"; diff --git a/mkosi.skeleton/etc/apt/apt.conf.d/50unattended-upgrades b/mkosi.skeleton/etc/apt/apt.conf.d/50unattended-upgrades new file mode 100644 index 0000000..f996348 --- /dev/null +++ b/mkosi.skeleton/etc/apt/apt.conf.d/50unattended-upgrades @@ -0,0 +1,33 @@ +// Unattended-Upgrade::Origins-Pattern controls which packages are +// upgraded. +Unattended-Upgrade::Origins-Pattern { + "origin=Ubuntu,archive=${distro_codename}-security"; + "o=Ubuntu,a=${distro_codename}"; + "o=Ubuntu,a=${distro_codename}-updates"; + "o=Ubuntu,a=${distro_codename}-proposed-updates"; + "o=Ubuntu,n=${distro_codename}-backports"; + }; + +// List of packages to not update (regexp are supported) +Unattended-Upgrade::Package-Blacklist { +}; + + +// Split the upgrade into the smallest possible chunks so that +// they can be interrupted with SIGUSR1. This makes the upgrade +// a bit slower but it has the benefit that shutdown while a upgrade +// is running is possible (with a small delay) +Unattended-Upgrade::MinimalSteps "true"; + + +// Do automatic removal of new unused dependencies after the upgrade +// (equivalent to apt-get autoremove) +Unattended-Upgrade::Remove-Unused-Dependencies "true"; + + +// Do upgrade application even if it requires restart after upgrade +// I.e. "XB-Upgrade-Requires: app-restart" is set in the debian/control file +Unattended-Upgrade::IgnoreAppsRequireRestart "true"; + +// Automatically run "dpkg --force-confold --configure -a". +Unattended-Upgrade::AutoFixInterruptedDpkg "true"; diff --git a/mkosi.skeleton/etc/systemd/system/multi-user.target.wants/sabnzbd.service b/mkosi.skeleton/etc/systemd/system/multi-user.target.wants/sabnzbd.service new file mode 120000 index 0000000..7d8ab3e --- /dev/null +++ b/mkosi.skeleton/etc/systemd/system/multi-user.target.wants/sabnzbd.service @@ -0,0 +1 @@ +../sabnzbd.service
\ No newline at end of file diff --git a/mkosi.skeleton/etc/systemd/system/sabnzbd.service b/mkosi.skeleton/etc/systemd/system/sabnzbd.service new file mode 100644 index 0000000..d800fe0 --- /dev/null +++ b/mkosi.skeleton/etc/systemd/system/sabnzbd.service @@ -0,0 +1,16 @@ +[Unit] +Description=SabNZB Daemon +After=network.target + +[Service] +User=warez +Group=warez +Umask=022 + +Type=forking +ExecStart=/usr/bin/sabnzbdplus --daemon --config-file /config --server 0.0.0.0:8080 +TimeoutStopSec=20 +Restart=on-failure + +[Install] +WantedBy=multi-user.target |