test for error code from db creation and if there is an error, die with an error code.
This commit is contained in:
parent
22c5d46c65
commit
17e0b4ac4b
|
@ -31,6 +31,10 @@ if [ "$1" = "configure" ]; then
|
|||
# test if database if already present...
|
||||
if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then
|
||||
cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/debian.cnf
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error creating db."
|
||||
exit 1;
|
||||
fi
|
||||
# This creates the user.
|
||||
echo "grant lock tables, alter,select,insert,update,delete,create,index on ${ZM_DB_NAME}.* to '${ZM_DB_USER}'@localhost identified by \"${ZM_DB_PASS}\";" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
||||
else
|
||||
|
|
|
@ -34,6 +34,10 @@ if [ "$1" = "configure" ]; then
|
|||
# test if database if already present...
|
||||
if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then
|
||||
cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/debian.cnf
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error creating db."
|
||||
exit 1;
|
||||
fi
|
||||
# This creates the user.
|
||||
echo "grant lock tables, alter,drop,select,insert,update,delete,create,index,alter routine,create routine, trigger,execute on ${ZM_DB_NAME}.* to '${ZM_DB_USER}'@localhost identified by \"${ZM_DB_PASS}\";" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
||||
else
|
||||
|
|
|
@ -56,6 +56,10 @@ if [ "$1" = "configure" ]; then
|
|||
if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then
|
||||
echo "Creating zm db"
|
||||
cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/debian.cnf
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error creating db."
|
||||
exit 1;
|
||||
fi
|
||||
# This creates the user.
|
||||
echo "grant lock tables,alter,drop,select,insert,update,delete,create,index,alter routine,create routine, trigger,execute on ${ZM_DB_NAME}.* to '${ZM_DB_USER}'@localhost identified by \"${ZM_DB_PASS}\";" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue