Bash: Various improvement for compiler and db_assembler

Now db_assembler also creates the users specified in conf.sh files if not exists

+ Simplified some paths for compilation
This commit is contained in:
Yehonal
2017-09-26 12:53:46 +02:00
parent c85b1b591e
commit eb78254579
4 changed files with 14 additions and 11 deletions

View File

@@ -5,10 +5,6 @@ then
CCTYPE=${CCTYPE^} # capitalize first letter if it's not yet CCTYPE=${CCTYPE^} # capitalize first letter if it's not yet
fi fi
BUILDPATH=$BINPATH [ $CTYPE == "Debug" ] && BUILDPATH="$BUILDPATH/debug/" || BUILDPATH="$BUILDPATH/release/"
INSTALL_PATH=$(readlink -f "$BINPATH/../") [ $CTYPE == "Debug" ] && BINPATH="$BINPATH/debug/" || BINPATH="$BINPATH/release/"
[ $CTYPE == "Debug" ] && BUILDPATH="$BUILDPATH/debug/build/" || BUILDPATH="$BUILDPATH/release/build/"
[ $CTYPE == "Debug" ] && BINPATH="$BINPATH/debug" || BINPATH="$BINPATH/release"

View File

@@ -10,8 +10,7 @@ fi
function ac_on_after_build() { function ac_on_after_build() {
# move the run engine # move the run engine
mkdir -p "$INSTALL_PATH/bin/" cp -rvf "$AC_PATH_MODULES/acore/startup-scripts/"* "$BINPATH"
cp -rvf "$AC_PATH_MODULES/acore/startup-scripts/"* "$INSTALL_PATH/bin/"
} }
registerHooks "ON_AFTER_BUILD" ac_on_after_build registerHooks "ON_AFTER_BUILD" ac_on_after_build

View File

@@ -29,6 +29,10 @@ function dbasm_mysqlExec() {
read -p "Insert mysql pass:" -s PROMPT_PASS read -p "Insert mysql pass:" -s PROMPT_PASS
export MYSQL_PWD=$PROMPT_PASS export MYSQL_PWD=$PROMPT_PASS
# create configured account if not exists
"$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" $options -e "CREATE USER '${MYSQL_USER}'@'${MYSQL_HOST}' IDENTIFIED BY '${MYSQL_PASS}' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;"
"$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" $options -e "GRANT USAGE ON * . * TO '${MYSQL_USER}'@'${MYSQL_HOST}' WITH GRANT OPTION;"
retval=$("$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" $options -e "$command") retval=$("$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" $options -e "$command")
else else
exit exit
@@ -73,11 +77,15 @@ function dbasm_createDB() {
eval $confs eval $confs
CONF_USER=$MYSQL_USER
CONF_PASS=$MYSQL_PASS
if dbasm_dbExists $dbname "$confs"; then if dbasm_dbExists $dbname "$confs"; then
echo "$dbname database exists" echo "$dbname database exists"
else else
echo "Creating DB ${dbname} ..." echo "Creating DB ${dbname} ..."
dbasm_mysqlExec "$confs" "CREATE DATABASE \`${dbname}\`" "" dbasm_mysqlExec "$confs" "CREATE DATABASE \`${dbname}\`" ""
dbasm_mysqlExec "$confs" "GRANT ALL PRIVILEGES ON \`${dbname}\` . * TO '${CONF_USER}'@'${MYSQL_HOST}' WITH GRANT OPTION;"
fi fi
} }

View File

@@ -2,13 +2,13 @@
SRCPATH="$AC_PATH_ROOT" SRCPATH="$AC_PATH_ROOT"
# absolute path where build files must be stored # absolute path where build files must be stored
BUILDPATH="$AC_PATH_ROOT/build/" BUILDPATH="$AC_PATH_ROOT/build/obj"
# absolute path where binary files must be stored # absolute path where binary files must be stored
BINPATH="$AC_PATH_ROOT/build/bin/" BINPATH="$AC_PATH_ROOT/build/dist"
# absolute path where config. files must be stored # absolute path where config. files must be stored
CONFDIR="$AC_PATH_ROOT/build/bin/etc/" CONFDIR="$AC_PATH_ROOT/build/dist/etc/"
############################################## ##############################################
# #