-if [[ -z "$NO_PACKAGES" ]]
-then
- [ "$USER" != "root" ] && echo "Needed root privileges" >&2 && exit 1
- _install_mysql_package || exit 1
+# Create or update database
+if db_exists $DB_NAME $TEMPFILE ; then
+ if [[ -n $FORCEDB ]] ; then
+ # DBDELETEPARAM=""
+ # [[ -n $QUIET_MODE ]] && DBDELETEPARAM="-f"
+ DBDELETEPARAM="-f"
+ _delete_db
+ _create_db
+ elif [[ -n $UPDATEDB ]] ; then
+ _update_db
+ elif [[ -z $QUIET_MODE ]] ; then
+ echo "database '$DB_NAME' exist. Reinstall it?"
+ read -e -p "Type 'y' to drop and reinstall exiting database (content will be lost), Type 'n' to update existing database (y/N)? " KK_
+ if [ "$KK_" == "yes" ] || [ "$KK_" != "y" ] ; then
+ _delete_db
+ _create_db
+ else
+ _update_db
+ fi
+ else
+ echo "Database '$DB_NAME' exists. Use option '--forcedb' to force the deletion of the existing one, or '--updatedb' to use existing one and update it"
+ exit 1
+ fi
+else
+ _create_db