Skip to content

Commit

Permalink
MDEV-9165: Run chown much faster on the datadir during install/update
Browse files Browse the repository at this point in the history
  • Loading branch information
ottok committed Nov 26, 2016
1 parent 618edd4 commit 3a6e781
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions debian/mariadb-server-10.2.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ EOF
# circumstances as it contains scripts that are executed by root.
set +e
chown -R 0:0 $mysql_statedir
chown -R mysql $mysql_datadir
find $mysql_datadir ! -uid $(id -u mysql) -print0 | xargs -0 -r chown mysql
chown -R mysql:adm $mysql_logdir
chmod 2750 $mysql_logdir
set -e
Expand All @@ -144,7 +144,7 @@ EOF
bash /usr/bin/mysql_install_db --rpm --cross-bootstrap --user=mysql --disable-log-bin 2>&1 | $ERR_LOGGER
set -e


## On every reconfiguration the maintenance user is recreated.
#
# - It is easier to regenerate the password every time but as people
Expand All @@ -163,7 +163,7 @@ EOF
# the old query which always succeeds and then the new which may or may not.

# recreate the credentials file if not present or without mysql_upgrade stanza
dc=$mysql_cfgdir/debian.cnf;
dc=$mysql_cfgdir/debian.cnf;
if [ -e "$dc" -a -n "`fgrep mysql_upgrade $dc 2>/dev/null`" ]; then
pass="`sed -n 's/^[ ]*password *= *// p' $dc | head -n 1`"
else
Expand Down
2 changes: 1 addition & 1 deletion debian/mariadb-server-10.2.preinst
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ fi
# The "set +e" is necessary as e.g. a ".journal" of a ext3 partition is
# not chgrp'able (#318435).
set +e
chown mysql:mysql $mysql_datadir
find $mysql_datadir ! -uid $(id -u mysql) -print0 | xargs -0 -r chown mysql
find $mysql_datadir -follow -not -group mysql -print0 2>/dev/null \
| xargs -0 --no-run-if-empty chgrp mysql
set -e
Expand Down

0 comments on commit 3a6e781

Please sign in to comment.