]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
build/ops: add sanity checks to run-make-check.sh 12683/head
authorNathan Cutler <ncutler@suse.com>
Tue, 27 Dec 2016 11:59:29 +0000 (12:59 +0100)
committerNathan Cutler <ncutler@suse.com>
Tue, 27 Dec 2016 11:59:29 +0000 (12:59 +0100)
Signed-off-by: Nathan Cutler <ncutler@suse.com>
run-make-check.sh

index ed77d672f1998a73c3c58fdb266c732fbbbc0f9e..837723909b2776fa0c46ef9ffeea223533ce9025 100755 (executable)
@@ -35,6 +35,10 @@ function run() {
     local install_cmd
     if test -f /etc/redhat-release ; then
         source /etc/os-release
+        if ! type bc > /dev/null 2>&1 ; then
+            echo "Please install bc and re-run." 
+            exit 1
+        fi
         if test "$(echo "$VERSION_ID >= 22" | bc)" -ne 0; then
             install_cmd="dnf -y install"
         else
@@ -44,6 +48,12 @@ function run() {
 
     type apt-get > /dev/null 2>&1 && install_cmd="apt-get install -y"
     type zypper > /dev/null 2>&1 && install_cmd="zypper --gpg-auto-import-keys --non-interactive install"
+
+    if ! type sudo > /dev/null 2>&1 ; then
+        echo "Please install sudo and re-run. This script assumes it is running"
+        echo "as a normal user with the ability to run commands as root via sudo." 
+        exit 1
+    fi
     if [ -n "$install_cmd" ]; then
         $DRY_RUN sudo $install_cmd ccache jq
     else
@@ -60,6 +70,10 @@ function run() {
 }
 
 function main() {
+    if [[ $EUID -eq 0 ]] ; then
+        echo "For best results, run this script as a normal user configured"
+        echo "with the ability to run commands as root via sudo."
+    fi
     echo -n "Checking hostname sanity... "
     if hostname --fqdn >/dev/null 2>&1 ; then
         echo "OK"