summaryrefslogtreecommitdiff
path: root/extensions/strip-device-nodes.configure
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-12-23 14:31:52 +0000
committerPaul Sherwood <paul.sherwood@codethink.co.uk>2016-10-07 17:58:13 +0000
commit5bca5fc3e8215601d1e2d33ce31f6a41c4bcfcc9 (patch)
treed56cb8d83a4ee82dd2ac6ebced7c007892573782 /extensions/strip-device-nodes.configure
parent50e5abede697ca0cfbfce46e28f9cb7775762746 (diff)
downloaddefinitions-5bca5fc3e8215601d1e2d33ce31f6a41c4bcfcc9.tar.gz
Add ostree.write deployment extension
This is a simple deployment extension to write the results of a Baserock build to an OSTree repo. See ostree.write.help for more information. The Baserock reference systems contain static device nodes, which are not supported by OSTree, and are obsolete on Linux systems. To work around this problem, I added a strip-device-nodes.configure extension. The systems should still work the same as devtmpfs will create the device nodes. I've tested this by deploying minimal-system-x86_64 to an OSTree repo, then checking it out into a temporary directory, creating a read-only bind-mount of the temporary directory and chrooting then into it. This is only going to be useful for containers systems and chroots for the time being. We would need to make some quite major changes to the Baserock reference systems to enable deployment to VMs or bare metal using OSTree. Change-Id: I8556139d118da759360cdc1ce998590b1f50b644
Diffstat (limited to 'extensions/strip-device-nodes.configure')
-rw-r--r--extensions/strip-device-nodes.configure40
1 files changed, 40 insertions, 0 deletions
diff --git a/extensions/strip-device-nodes.configure b/extensions/strip-device-nodes.configure
new file mode 100644
index 00000000..9f09b560
--- /dev/null
+++ b/extensions/strip-device-nodes.configure
@@ -0,0 +1,40 @@
+#!/bin/sh
+# Copyright (C) 2015 Codethink Limited
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# See strip-device-nodes.configure.help for documentation.
+
+set -eu
+
+case "$STRIP_DEVICE_NODES" in
+ yes|Yes|YES|true|True|TRUE|1)
+ run=yes ;;
+ *)
+ run=no ;;
+esac
+
+if [ "$run" = "yes" ]; then
+ echo "Stripping device nodes"
+
+ root="$1"
+
+ # Be VERY CAREFUL because this runs in the host system as root.
+ if [ "$(readlink -f $1)" = / ]; then
+ echo "Refusing to remove files from /, as a safety precausion."
+ exit 1
+ fi
+
+ rm -R "$1"/dev/*
+fi