+GIT_URL=https://osm.etsi.org/gerrit/osm/openvim.git
+DBUSER="root"
+DBPASSWD=""
+DBPASSWD_PARAM=""
+QUIET_MODE=""
+DEVELOP=""
+NO_PACKAGES=""
+while getopts ":u:p:hiq-:" o; do
+ case "${o}" in
+ u)
+ export DBUSER="$OPTARG"
+ ;;
+ p)
+ export DBPASSWD="$OPTARG"
+ export DBPASSWD_PARAM="-p$OPTARG"
+ ;;
+ q)
+ export QUIET_MODE=yes
+ export DEBIAN_FRONTEND=noninteractive
+ ;;
+ h)
+ usage && exit 0
+ ;;
+ -)
+ [ "${OPTARG}" == "help" ] && usage && exit 0
+ [ "${OPTARG}" == "develop" ] && DEVELOP="y" && continue
+ [ "${OPTARG}" == "quiet" ] && export QUIET_MODE=yes && export DEBIAN_FRONTEND=noninteractive && continue
+ [ "${OPTARG}" == "skip-install-packages" ] && export NO_PACKAGES=yes && continue
+ echo -e "Invalid option: '--$OPTARG'\nTry $0 --help for more information" >&2
+ exit 1
+ ;;
+ \?)
+ echo -e "Invalid option: '-$OPTARG'\nTry $0 --help for more information" >&2
+ exit 1
+ ;;
+ :)
+ echo -e "Option '-$OPTARG' requires an argument\nTry $0 --help for more information" >&2
+ exit 1
+ ;;
+ *)
+ usage >&2
+ exit -1
+ ;;
+ esac
+done
+
+#check root privileges and non a root user behind
+[ "$USER" != "root" ] && echo "Needed root privileges" >&2 && exit -1
+if [[ -z "$SUDO_USER" ]] || [[ "$SUDO_USER" = "root" ]]
+then
+ [[ -z $QUIET_MODE ]] && read -e -p "Install in the root user (y/N)?" KK
+ [[ -z $QUIET_MODE ]] && [[ "$KK" != "y" ]] && [[ "$KK" != "yes" ]] && echo "Cancelled" && exit 1
+ export SUDO_USER=root
+fi