diff options
-rwxr-xr-x | extensions/install-essential-files.configure | 10 | ||||
-rwxr-xr-x | extensions/install-files.configure | 12 | ||||
-rw-r--r-- | extensions/install-files.configure.help | 12 |
3 files changed, 28 insertions, 6 deletions
diff --git a/extensions/install-essential-files.configure b/extensions/install-essential-files.configure index 3d33fe03..8314b56d 100755 --- a/extensions/install-essential-files.configure +++ b/extensions/install-essential-files.configure @@ -27,6 +27,14 @@ import subprocess import sys target_root = sys.argv[1] + +# Clear all INSTALL_FILES environment variable options, +# so we don't end up installing INSTALL_FILES_foo multiple times. +for var in list(os.environ): + if var.startswith("INSTALL_FILES"): + del os.environ[var] + +# Force installation of the essential-files manifest os.environ["INSTALL_FILES"] = "install-files/essential-files/manifest" -command = os.path.join("extensions/install-files.configure") +command = "extensions/install-files.configure" subprocess.check_call([command, target_root]) diff --git a/extensions/install-files.configure b/extensions/install-files.configure index 64fcecca..782065d1 100755 --- a/extensions/install-files.configure +++ b/extensions/install-files.configure @@ -16,7 +16,7 @@ ''' A Morph configuration extension for adding arbitrary files to a system -It will read the manifest files specified in the environment variable +It will read the manifest files specified in environment variables starting INSTALL_FILES, then use the contens of those files to determine which files to install into the target system. @@ -41,12 +41,14 @@ import writeexts class InstallFilesConfigureExtension(writeexts.Extension): def process_args(self, args): - if not 'INSTALL_FILES' in os.environ: + if not any(var.startswith('INSTALL_FILES') for var in os.environ): return target_root = args[0] - manifests = shlex.split(os.environ['INSTALL_FILES']) - for manifest in manifests: - self.install_manifest(manifest, target_root) + for manifest_var in sorted((var for var in os.environ + if var.startswith('INSTALL_FILES'))): + manifests = shlex.split(os.environ[manifest_var]) + for manifest in manifests: + self.install_manifest(manifest, target_root) def install_manifest(self, manifest, target_root): manifest_dir = os.path.dirname(manifest) diff --git a/extensions/install-files.configure.help b/extensions/install-files.configure.help index 991c26c8..191e1378 100644 --- a/extensions/install-files.configure.help +++ b/extensions/install-files.configure.help @@ -40,6 +40,18 @@ help: | INSTALL_FILES: sshkeysfiles/manifest + All variables starting INSTALL_FILES are considered, and are processed in + alphabetical order, so if INSTALL_FILES, INSTALL_FILES_distbuild and + INSTALL_FILES_openstack are given, manifests in INSTALL_FILES are processed + before those in INSTALL_FILES_distbuild, followed by INSTALL_FILES_openstack. + + Multiple manifest files may be given in the same INSTALL_FILES variable, + by providing a whitespace separated list. + + Shell word splitting is supported, so if a manifest's path has spaces in, + the path may be shell escaped. + + More generally entries in the manifest are formatted as: [overwrite] <octal mode> <uid decimal> <gid decimal> <filename> |