Merge branch 'master' into f24

This commit is contained in:
Honza Horak 2016-07-15 12:11:32 +02:00
commit 52352756bf

View File

@ -89,7 +89,12 @@ if should_initialize "$datadir" ; then
# Now create the database # Now create the database
echo "Initializing @NICE_PROJECT_NAME@ database" echo "Initializing @NICE_PROJECT_NAME@ database"
CURRENT_TIME=`LANG=C date -u` # Avoiding deletion of files not created by mysql_install_db is
# guarded by time check and sleep should help work-arounded
# potential issues on systems with 1 second resolution timestamps
# https://bugzilla.redhat.com/show_bug.cgi?id=1335849#c19
INITDB_TIMESTAMP=`LANG=C date -u`
sleep 1
@bindir@/mysql_install_db --rpm --datadir="$datadir" --user="$myuser" @bindir@/mysql_install_db --rpm --datadir="$datadir" --user="$myuser"
ret=$? ret=$?
if [ $ret -ne 0 ] ; then if [ $ret -ne 0 ] ; then
@ -99,12 +104,7 @@ if should_initialize "$datadir" ; then
if [ ! -e "$datadir/mysql/user.frm" ] && [ -d "$datadir" ] ; then if [ ! -e "$datadir/mysql/user.frm" ] && [ -d "$datadir" ] ; then
echo "Initialization of @NICE_PROJECT_NAME@ database was not finished successfully." >&2 echo "Initialization of @NICE_PROJECT_NAME@ database was not finished successfully." >&2
echo "Files created so far will be removed." >&2 echo "Files created so far will be removed." >&2
# Avoiding deletion of files not created by mysql_install_db is find "$datadir" -mindepth 1 -maxdepth 1 -newermt "$INITDB_TIMESTAMP" \
# guarded by time check and sleep should help work-arounded
# potential issues on systems with 1 second resolution timestamps
# https://bugzilla.redhat.com/show_bug.cgi?id=1335849#c19
sleep 1
find "$datadir" -mindepth 1 -maxdepth 1 -newermt "$CURRENT_TIME" \
-not -name "lost+found" -exec rm -rf {} + -not -name "lost+found" -exec rm -rf {} +
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
echo "Removing of created files was not successfull." >&2 echo "Removing of created files was not successfull." >&2
@ -123,12 +123,12 @@ if should_initialize "$datadir" ; then
else else
if [ -d "$datadir/mysql/" ] ; then if [ -d "$datadir/mysql/" ] ; then
# mysql dir exists, it seems data are initialized properly # mysql dir exists, it seems data are initialized properly
echo "Database MariaDB is probably initialized in $datadir already, nothing is done." echo "Database @NICE_PROJECT_NAME@ is probably initialized in $datadir already, nothing is done."
echo "If this is not the case, make sure the $datadir is empty before running `basename $0`." echo "If this is not the case, make sure the $datadir is empty before running `basename $0`."
else else
# if the directory is not empty but mysql/ directory is missing, then # if the directory is not empty but mysql/ directory is missing, then
# print error and let user to initialize manually or empty the directory # print error and let user to initialize manually or empty the directory
echo "Database MariaDB is not initialized, but the directory $datadir is not empty, so initialization cannot be done." echo "Database @NICE_PROJECT_NAME@ is not initialized, but the directory $datadir is not empty, so initialization cannot be done."
echo "Make sure the $datadir is empty before running `basename $0`." echo "Make sure the $datadir is empty before running `basename $0`."
exit 1 exit 1
fi fi