summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis Eriksen <d@ennis.no>2020-01-20 10:33:01 +0100
committerDennis Eriksen <d@ennis.no>2020-01-20 10:33:01 +0100
commitb62ddf8032289b92fd8a0295a6afec3c5cbabc1c (patch)
tree29c4f2ea11be25b6b85945e55924170d70b037b8
downloadmkosi-miniflux-b62ddf8032289b92fd8a0295a6afec3c5cbabc1c.tar.gz
Initial commit
-rw-r--r--.gitignore2
-rw-r--r--mkosi.default18
-rw-r--r--mkosi.extra/etc/apt/apt.conf.d/20auto-upgrades9
-rw-r--r--mkosi.extra/etc/apt/apt.conf.d/50unattended-upgrades34
-rw-r--r--mkosi.extra/etc/systemd/system/miniflux.service.d/override.conf2
-rw-r--r--mkosi.nspawn14
-rwxr-xr-xmkosi.postinst29
7 files changed, 108 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..b3afc8c
--- /dev/null
+++ b/mkosi.default
@@ -0,0 +1,18 @@
+[Distribution]
+Distribution=ubuntu
+Release=bionic
+Repositories=main,universe
+Mirror=http://no.archive.ubuntu.com
+
+[Output]
+Format=directory
+Output=/var/lib/machines/miniflux
+
+[Packages]
+WithNetwork=yes
+Packages=
+ unattended-upgrades
+ curl
+ ca-certificates
+ locales
+ gnupg
diff --git a/mkosi.extra/etc/apt/apt.conf.d/20auto-upgrades b/mkosi.extra/etc/apt/apt.conf.d/20auto-upgrades
new file mode 100644
index 0000000..4c725ab
--- /dev/null
+++ b/mkosi.extra/etc/apt/apt.conf.d/20auto-upgrades
@@ -0,0 +1,9 @@
+APT::Periodic::Unattended-Upgrade "1";
+
+APT::Periodic::Update-Package-Lists "1";
+
+
+APT::Periodic::AutocleanInterval "7";
+
+
+
diff --git a/mkosi.extra/etc/apt/apt.conf.d/50unattended-upgrades b/mkosi.extra/etc/apt/apt.conf.d/50unattended-upgrades
new file mode 100644
index 0000000..768347b
--- /dev/null
+++ b/mkosi.extra/etc/apt/apt.conf.d/50unattended-upgrades
@@ -0,0 +1,34 @@
+// 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.extra/etc/systemd/system/miniflux.service.d/override.conf b/mkosi.extra/etc/systemd/system/miniflux.service.d/override.conf
new file mode 100644
index 0000000..bb5c925
--- /dev/null
+++ b/mkosi.extra/etc/systemd/system/miniflux.service.d/override.conf
@@ -0,0 +1,2 @@
+[Service]
+EnvironmentFile=/etc/miniflux/miniflux.conf
diff --git a/mkosi.nspawn b/mkosi.nspawn
new file mode 100644
index 0000000..63fe045
--- /dev/null
+++ b/mkosi.nspawn
@@ -0,0 +1,14 @@
+[Exec]
+Hostname=miniflux
+ResolvConf=copy-host
+Timezone=copy
+PrivateUsers=pick
+NoNewPrivileges=yes
+
+[Files]
+PrivateUsersChown=yes
+BindReadOnly=/etc/miniflux/miniflux.conf
+
+[Network]
+VirtualEthernet=no
+
diff --git a/mkosi.postinst b/mkosi.postinst
new file mode 100755
index 0000000..1c599bb
--- /dev/null
+++ b/mkosi.postinst
@@ -0,0 +1,29 @@
+#!/bin/sh
+set -ex
+export DEBIAN_FRONTEND=noninteractive
+
+# motd
+chmod 644 /etc/update-motd.d/*
+systemctl mask motd-news.service
+systemctl mask motd-news.timer
+
+# Add update- and security-repositories, and perform upgrade
+RELEASE=$(cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F'=' '{print $2}')
+echo "deb http://no.archive.ubuntu.com ${RELEASE}-security main universe" >> /etc/apt/sources.list
+echo "deb http://no.archive.ubuntu.com ${RELEASE}-updates main universe" >> /etc/apt/sources.list
+apt update && apt --yes full-upgrade && apt --yes autoremove
+
+# locales
+sed -i 's/# en_IE.UTF-8 UTF-8/en_IE.UTF-8 UTF-8/' /etc/locale.gen
+locale-gen
+
+# install miniflux
+curl -s https://apt.miniflux.app/KEY.gpg | apt-key add -
+echo "deb https://apt.miniflux.app/ /" > /etc/apt/sources.list.d/miniflux.list
+apt update
+
+apt install --yes miniflux
+
+mkdir /etc/miniflux
+chown miniflux:miniflux /etc/miniflux
+chmod 700 /etc/miniflux