From e34226f21b01a49a0690b4ff8a4e39b4de680a32 Mon Sep 17 00:00:00 2001 From: dennis Date: Sun, 20 Oct 2019 13:43:07 +0200 Subject: initial commit --- .gitignore | 2 ++ mkosi.default | 19 +++++++++++++ mkosi.nspawn | 15 ++++++++++ mkosi.postinst | 22 +++++++++++++++ mkosi.skeleton/etc/apt/apt.conf.d/20auto-upgrades | 6 ++++ .../etc/apt/apt.conf.d/50unattended-upgrades | 33 ++++++++++++++++++++++ .../plexmediaserver.service | 1 + 7 files changed, 98 insertions(+) create mode 100644 .gitignore create mode 100644 mkosi.default create mode 100644 mkosi.nspawn create mode 100755 mkosi.postinst create mode 100644 mkosi.skeleton/etc/apt/apt.conf.d/20auto-upgrades create mode 100644 mkosi.skeleton/etc/apt/apt.conf.d/50unattended-upgrades create mode 120000 mkosi.skeleton/etc/systemd/system/multi-user.target.wants/plexmediaserver.service 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..31f8074 --- /dev/null +++ b/mkosi.default @@ -0,0 +1,19 @@ +[Distribution] +Distribution=ubuntu +Release=bionic +Repositories=main,universe +Mirror=http://no.archive.ubuntu.com + +[Output] +Format=directory +Output=/var/lib/machines/plex + +[Packages] +WithNetwork=yes +Packages= + unattended-upgrades + apt-transport-https + ca-certificates + curl + gnupg + udev diff --git a/mkosi.nspawn b/mkosi.nspawn new file mode 100644 index 0000000..93645c3 --- /dev/null +++ b/mkosi.nspawn @@ -0,0 +1,15 @@ +[Exec] +Hostname=plex +ResolvConf=copy-host +Timezone=copy +PrivateUsers=false +NoNewPrivilegs=yes + +[Files] +#PrivateUsersChown=yes +Bind=/var/local/docker-plex:/var/lib/plexmediaserver +Bind=/var/cache/plextranscode:/transcode +Bind=/srv/cold:/srv/cold + +[Network] +VirtualEthernet=no diff --git a/mkosi.postinst b/mkosi.postinst new file mode 100755 index 0000000..303a4eb --- /dev/null +++ b/mkosi.postinst @@ -0,0 +1,22 @@ +#!/bin/sh +set -ex + +export DEBIAN_FRONTEND=noninteractive +export XDG_CONFIG_HOME="/config/xdg" + +groupadd --system --gid 997 plex +useradd --system --gid 997 --uid 997 plex + +echo deb https://downloads.plex.tv/repo/deb public main > /etc/apt/sources.list.d/plex.list + +curl https://downloads.plex.tv/plex-keys/PlexSign.key | apt-key add - + +apt update + +apt install --yes plexmediaserver + +# plex adds its own repo-file, with everything commented out. I guess plex +# wants to do in-app upgrades. +rm /etc/apt/sources.list.d/plex.list + +apt update 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/plexmediaserver.service b/mkosi.skeleton/etc/systemd/system/multi-user.target.wants/plexmediaserver.service new file mode 120000 index 0000000..7dd4439 --- /dev/null +++ b/mkosi.skeleton/etc/systemd/system/multi-user.target.wants/plexmediaserver.service @@ -0,0 +1 @@ +/lib/systemd/system/plexmediaserver.service \ No newline at end of file -- cgit v1.2.3