diff options
author | dennis <dennis@mrslave> | 2019-10-20 13:43:07 +0200 |
---|---|---|
committer | dennis <dennis@mrslave> | 2019-10-20 13:43:07 +0200 |
commit | e34226f21b01a49a0690b4ff8a4e39b4de680a32 (patch) | |
tree | f1edb9523e69b0292d1b5fc2d212d3495b0246a5 | |
download | mkosi-plex-e34226f21b01a49a0690b4ff8a4e39b4de680a32.tar.gz |
initial commit
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | mkosi.default | 19 | ||||
-rw-r--r-- | mkosi.nspawn | 15 | ||||
-rwxr-xr-x | mkosi.postinst | 22 | ||||
-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/plexmediaserver.service | 1 |
7 files changed, 98 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..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 |