From: Alexandru Avadanii Date: Mon, 17 Jul 2017 23:10:25 +0000 Subject: [PATCH] deploy: Allow non-root deploys Signed-off-by: Alexandru Avadanii --- ci/deploy.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ci/deploy.sh b/ci/deploy.sh index aec8048..c1ec31b 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -87,7 +87,7 @@ $(notify "Disabled input parameters (not yet supported with MCP):" 3) -i (disabled) .iso image to be deployed (needs to be provided in a URI style, it can be a local resource: file:// or a remote resource http(s)://) -$(notify "[NOTE] Root priviledges are needed for this script to run" 3) +$(notify "[NOTE] sudo priviledges are needed for this script to run" 3) Example: @@ -240,8 +240,8 @@ do esac done -if [[ $EUID -ne 0 ]]; then - notify "[ERROR] This script must be run as root\n" 1>&2 +if [[ "$(sudo whoami)" != 'root' ]]; then + notify "This script requires sudo rights\n" 1>&2 exit 1 fi @@ -269,10 +269,10 @@ pushd "${DEPLOY_DIR}" > /dev/null # scenario, etc. # Install required packages -[ -n "$(command -v apt-get)" ] && apt-get install -y \ +[ -n "$(command -v apt-get)" ] && sudo apt-get install -y \ git make rsync mkisofs curl virtinst cpu-checker qemu-kvm vgabios && \ ln -sf /usr/share/vgabios/vgabios.bin /usr/share/qemu/vgabios-stdvga.bin -[ -n "$(command -v yum)" ] && yum install -y \ +[ -n "$(command -v yum)" ] && sudo yum install -y \ git make rsync genisoimage curl virt-install qemu-kvm vgabios # Check scenario file existence