summaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2012-06-17 13:47:16 -0400
committerWill Woods <wwoods@redhat.com>2012-06-19 17:02:45 -0400
commitef891e486e77f7e43b9bd0ee2df92776bf7640fd (patch)
treef6f0fdedcdf845ef7bf9d533e2dc2c7b81fe9841 /data
parent100e2588b5ab6415857914f49186bf4f69d2dd27 (diff)
downloadanaconda-ef891e486e77f7e43b9bd0ee2df92776bf7640fd.tar.gz
anaconda-ef891e486e77f7e43b9bd0ee2df92776bf7640fd.tar.xz
anaconda-ef891e486e77f7e43b9bd0ee2df92776bf7640fd.zip
Add anaconda-cleanup-initramfs.service
This adds anaconda-cleanup-initramfs.service, so we can clean unnecessary/redundant files out of /run/initramfs to save RAM. The initial cleanup strategy is to remove kernel modules, firmware, and the ssl certificate store, because the anaconda runtime has all these things already. This saves about 40MB RAM.
Diffstat (limited to 'data')
-rw-r--r--data/systemd/Makefile.am12
-rwxr-xr-xdata/systemd/anaconda-cleanup-initramfs18
-rw-r--r--data/systemd/anaconda-cleanup-initramfs.service10
3 files changed, 39 insertions, 1 deletions
diff --git a/data/systemd/Makefile.am b/data/systemd/Makefile.am
index 108d7e528..8579ece04 100644
--- a/data/systemd/Makefile.am
+++ b/data/systemd/Makefile.am
@@ -19,6 +19,16 @@
systemddir = /lib/systemd/system
generatordir = /lib/systemd/system-generators
-dist_systemd_DATA = anaconda-shell@.service anaconda.target anaconda@.service instperf.service anaconda-sshd.service
+
+dist_systemd_DATA = anaconda@.service \
+ anaconda.target \
+ anaconda-shell@.service \
+ instperf.service \
+ anaconda-sshd.service \
+ anaconda-cleanup-initramfs.service
+
dist_generator_SCRIPTS = anaconda-generator
+
+dist_sbin_SCRIPTS = anaconda-cleanup-initramfs
+
MAINTAINERCLEANFILES = Makefile.in
diff --git a/data/systemd/anaconda-cleanup-initramfs b/data/systemd/anaconda-cleanup-initramfs
new file mode 100755
index 000000000..66b6e0785
--- /dev/null
+++ b/data/systemd/anaconda-cleanup-initramfs
@@ -0,0 +1,18 @@
+#!/bin/bash
+# anaconda-cleanup-initramfs - clean up initramfs to save RAM.
+#
+# Normal systems just throw away the initramfs after boot, since they have a
+# copy of it in /boot/initramfs-$(uname -r).img that they can unpack and use
+# to shut down the system cleanly. (See dracut-shutdown.service.)
+#
+# We have to keep initramfs because we don't have it laying around in /boot,
+# and we might want to read some files out of it (e.g. /etc/cmdline*)
+#
+# There are still redundant/unneeded files, though, and we can save RAM by
+# cleaning those up.
+
+systemd-notify --pid --status="Removing unneeded files..."
+# the runtime has all the firmware/modules we need.
+# removing the ssl certs saves another easy ~1MB.
+rm -rf /run/initramfs/usr/lib/{firmware,modules} \
+ /run/initramfs/etc/ssl
diff --git a/data/systemd/anaconda-cleanup-initramfs.service b/data/systemd/anaconda-cleanup-initramfs.service
new file mode 100644
index 000000000..5bed880dd
--- /dev/null
+++ b/data/systemd/anaconda-cleanup-initramfs.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Clean Up Initramfs
+Before=anaconda@.service
+ConditionPathIsDirectory=/run/initramfs/usr/lib/modules
+
+[Service]
+Type=notify
+NotifyAccess=all
+RemainAfterExit=yes
+ExecStart=/usr/sbin/anaconda-cleanup-initramfs