Install static element files

Several elements want to install static files. Some do this using the
"os-apply-config" directory, which means these files are unnecessarily
rewritten every time os-refresh-config triggers. Others put files in a
"files" dir and manually script the installation from an install.d
script.

This patch offers a more convenient "static" directory. Files placed in
here will be rsynced into the image. This assumes all files are meant to
be installed with user and group root.

Co-Authored-By: Gregory Haynes <greg@greghaynes.net>
Change-Id: I390b822bf80ff6470b25a3473326cac362c4497a
This commit is contained in:
Alexis Lee 2014-07-29 17:29:35 +01:00 committed by Gregory Haynes
parent accd7600c4
commit 68d3b923a4
2 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,7 @@
Copy static files into the built image.
The contents of any ``static/`` subdirs of elements will be installed into
these images at build time using ``rsync -lCr``. So to install a file
``/etc/boo``, include ``static/etc/boo`` in your element.
Note: This installs all files with owner and group of root.

View File

@ -0,0 +1,10 @@
#!/bin/bash
# Note that this relies on the detail that all elements share one dir inside
# the chroot. This will copy all the files that elements have added to
# element/static into the image. Mode, symlinks etc will be respected.
set -eux
STATIC_SOURCE="$(dirname $0)/../static"
[ -d "${STATIC_SOURCE}" ] || exit 0
rsync -lCr "${STATIC_SOURCE}"/ /