From c8b534ffc9cef69ae83eb05ed8de873dcb95052a Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Sat, 14 Nov 2015 23:03:31 +0000 Subject: [PATCH] Give the mysql user suitable group membership. Give the developer sudo rights. - Legacy-Id: 10483 --- docker/docker-init.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docker/docker-init.sh b/docker/docker-init.sh index 61f70980d..b054bf50e 100644 --- a/docker/docker-init.sh +++ b/docker/docker-init.sh @@ -16,6 +16,13 @@ if [ ! -d $MYSQLDIR/mysql ]; then echo "WARNING: Expected the directory $MYSQLDIR/mysql/ to exist -- have you downloaded and unpacked the IETF binary database tarball?" fi +echo "Setting up the 'mysql' user for database file access ..." +MYSQL_TARGET_GID=$(stat -c "%g" $MYSQLDIR/mysql) +if ! grep -q ":$MYSQL_TARGET_GID:$" /etc/group; then + groupadd -g $MYSQL_TARGET_GID mysqldata +fi +usermod -a -G $MYSQL_TARGET_GID mysql + echo "Checking if MySQL is running ..." if ! /etc/init.d/mysql status; then echo "Starting mysql ..." @@ -54,7 +61,8 @@ fi if ! id -u "$USER" &> /dev/null; then echo "Creating user '$USER' ..." - useradd -s /bin/bash -G staff $USER + useradd -s /bin/bash -G staff,sudo $USER + echo "$USER:$USER" | chpasswd fi VIRTDIR="/opt/home/$USER/$TAG"