pacstrap/arch-chroot: require root privileges to run

Suggested by Pierre. This makes sense since somewhere along the line,
pacman or mount are going to complain.
This commit is contained in:
Dave Reisner 2012-06-19 08:12:20 -04:00
parent b60114252c
commit 542e888b48
2 changed files with 3 additions and 0 deletions

View File

@ -16,6 +16,7 @@ if [[ -z $1 || $1 = @(-h|--help) ]]; then
exit $(( $# ? 0 : 1 )) exit $(( $# ? 0 : 1 ))
fi fi
(( EUID == 0 )) || die 'This script must be run with root privileges'
[[ -d $1 ]] || die "Can't create chroot on non-directory %s" "$1" [[ -d $1 ]] || die "Can't create chroot on non-directory %s" "$1"

View File

@ -30,6 +30,8 @@ if [[ -z $1 || $1 = @(-h|--help) ]]; then
exit $(( $# ? 0 : 1 )) exit $(( $# ? 0 : 1 ))
fi fi
(( EUID == 0 )) || die 'This script must be run with root privileges'
while getopts ':dr:' flag; do while getopts ':dr:' flag; do
case $flag in case $flag in
d) d)