Alon Bar-Lev has uploaded a new change for review.

Change subject: packaging: setup: print proper message suggesting to run as root
......................................................................

packaging: setup: print proper message suggesting to run as root

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1037451
Change-Id: I3850b5c474e7bae47f2b240c19dee690d6c9e3ef
Signed-off-by: Alon Bar-Lev <alo...@redhat.com>
---
M Makefile
M packaging/setup/bin/ovirt-engine-remove
M packaging/setup/bin/ovirt-engine-rename
M packaging/setup/bin/ovirt-engine-setup
M packaging/setup/bin/ovirt-engine-setup.env.in
5 files changed, 19 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/74/22074/1

diff --git a/Makefile b/Makefile
index a3fb6ce..a1c89b8 100644
--- a/Makefile
+++ b/Makefile
@@ -147,6 +147,7 @@
        -e "s|@PACKAGE_VERSION@|$(PACKAGE_VERSION)|g" \
        -e "s|@DISPLAY_VERSION@|$(DISPLAY_VERSION)|g" \
        -e "s|@JBOSS_HOME@|$(JBOSS_HOME)|g" \
+       -e "s|@DEVMODE@|$(BUILD_DEV)|g" \
        $< > $@
 
 # List of files that will be generated from templates:
diff --git a/packaging/setup/bin/ovirt-engine-remove 
b/packaging/setup/bin/ovirt-engine-remove
index 972b308..b26ff2b 100755
--- a/packaging/setup/bin/ovirt-engine-remove
+++ b/packaging/setup/bin/ovirt-engine-remove
@@ -16,12 +16,6 @@
 # limitations under the License.
 #
 
-die() {
-       local m="$1"
-       echo "FATAL: ${m}" >&2
-       exit 1
-}
-
 usage() {
        cat << __EOF__
 Usage: $0
@@ -76,4 +70,4 @@
        esac
 done
 
-OTOPI_NONROOT=1 exec "${otopidir}/otopi" "${baseenv} ${environment} 
${otopienv}"
+exec "${otopidir}/otopi" "${baseenv} ${environment} ${otopienv}"
diff --git a/packaging/setup/bin/ovirt-engine-rename 
b/packaging/setup/bin/ovirt-engine-rename
index b64dc56..69cff67 100755
--- a/packaging/setup/bin/ovirt-engine-rename
+++ b/packaging/setup/bin/ovirt-engine-rename
@@ -16,12 +16,6 @@
 # limitations under the License.
 #
 
-die() {
-       local m="$1"
-       echo "FATAL: ${m}" >&2
-       exit 1
-}
-
 usage() {
        cat << __EOF__
 Usage: $0
@@ -81,4 +75,4 @@
        esac
 done
 
-OTOPI_NONROOT=1 exec "${otopidir}/otopi" "${baseenv} ${environment} 
${otopienv}"
+exec "${otopidir}/otopi" "${baseenv} ${environment} ${otopienv}"
diff --git a/packaging/setup/bin/ovirt-engine-setup 
b/packaging/setup/bin/ovirt-engine-setup
index f6fc384..43ebb1d 100755
--- a/packaging/setup/bin/ovirt-engine-setup
+++ b/packaging/setup/bin/ovirt-engine-setup
@@ -16,12 +16,6 @@
 # limitations under the License.
 #
 
-die() {
-       local m="$1"
-       echo "FATAL: ${m}" >&2
-       exit 1
-}
-
 usage() {
        cat << __EOF__
 Usage: $0
@@ -84,4 +78,4 @@
        esac
 done
 
-OTOPI_NONROOT=1 exec "${otopidir}/otopi" "${baseenv} ${environment} 
${otopienv}"
+exec "${otopidir}/otopi" "${baseenv} ${environment} ${otopienv}"
diff --git a/packaging/setup/bin/ovirt-engine-setup.env.in 
b/packaging/setup/bin/ovirt-engine-setup.env.in
index 0cecf9f..b74b396 100644
--- a/packaging/setup/bin/ovirt-engine-setup.env.in
+++ b/packaging/setup/bin/ovirt-engine-setup.env.in
@@ -1,5 +1,12 @@
 
 DEV_PYTHON_DIR="@DEV_PYTHON_DIR@"
+DEVMODE="@DEVMODE@"
+
+die() {
+       local m="$1"
+       echo "FATAL: ${m}" >&2
+       exit 1
+}
 
 ENV="/etc/ovirt-engine-setup.env.d"
 for f in $([ -d "${ENV}" ] && find "${ENV}" -name '*.env' | sort); do
@@ -21,3 +28,11 @@
        otopidir="${OTOPI_SOURCES}/src/bin"
 fi
 export PYTHONPATH="$(cd "${scriptdir}" && 
pwd)/..:${DEV_PYTHON_DIR:+${DEV_PYTHON_DIR}:}:${PYTHONPATH}"
+
+if [ "${DEVMODE}" = 1 ]; then
+       export OTOPI_NONROOT=1
+else
+       if [ "$(id -u)" != 0 ]; then
+               die "Please execute as root user"
+       fi
+fi


-- 
To view, visit http://gerrit.ovirt.org/22074
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3850b5c474e7bae47f2b240c19dee690d6c9e3ef
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to