From 3b387c376c813d611df05667e8f3490678ef5ba4 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Mon, 17 Oct 2016 08:10:28 +0000 Subject: Add ostree.write deployment extension Reverts commit 36f7e4923ae5d03dd345d74f7fcade48c99a498d 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: Ic393bdec7b28341fc5dfa56bb684217d964be5ff --- extensions/strip-device-nodes.configure | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 extensions/strip-device-nodes.configure (limited to 'extensions/strip-device-nodes.configure') 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 -- cgit v1.2.1