From 03611dc63e3e44d0504f0d05c3129fbc0b2d1510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= Date: Wed, 8 Jan 2014 01:15:37 +0100 Subject: Switch to root when started as regular user In collaborative builder machine, these scripts are often allowed to become root via sudo. This patch avoid to prefix them by sudo each time or call su. Signed-off-by: Pierre Schmitz --- mkarchroot.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mkarchroot.in') diff --git a/mkarchroot.in b/mkarchroot.in index 7cdb274..fb472bc 100644 --- a/mkarchroot.in +++ b/mkarchroot.in @@ -35,9 +35,10 @@ while getopts 'hC:M:c:' arg; do done shift $(($OPTIND - 1)) -(( $EUID != 0 )) && die 'This script must be run as root.' (( $# < 2 )) && die 'You must specify a directory and one or more packages.' +check_root "$0" "$@" + working_dir="$(readlink -f $1)" shift 1 -- cgit v1.2.3