From: Serge Hallyn Date: Thu, 9 May 2013 01:15:29 +0000 (-0500) Subject: templates: require running as root X-Git-Tag: lxc-1.0.0.alpha1~1^2~115 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5be56973e5e874a142263dfb164b0b03e18a65f3;p=thirdparty%2Flxc.git templates: require running as root Up to now lxc-create ensured that you were running as root. Now the templates which require root need to do it for themselves. Templates which do mknod definately require root. Signed-off-by: Serge Hallyn Acked-by: Stéphane Graber --- diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in index be2a5357f..ce7226f73 100644 --- a/templates/lxc-alpine.in +++ b/templates/lxc-alpine.in @@ -250,6 +250,12 @@ default_path=@LXCPATH@ release= arch=$(uname -m) +# template mknods, requires root +if [ $(id -u) -ne 0 ]; then + echo "$(basename $0): must be run as root" >&2 + exit 1 +fi + while [ $# -gt 0 ]; do opt="$1" shift