diff --git a/Dockerfile b/Dockerfile index 84f725f..05b594f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -101,6 +101,7 @@ RUN \ # fix postgres-9.6 instead of 9.5 && sed -i -e "s/postgresql postgresql\-contrib /postgresql\-9\.6 postgresql\-contrib\-9\.6 postgresql\-client\-9\.6 /g" /tmp/vst-install-ubuntu.sh \ + && echo "echo \$vpass > /root/.my.pass" >> /tmp/vst-install-ubuntu.sh \ # begin install vesta && bash /tmp/vst-install-ubuntu.sh \ @@ -430,7 +431,7 @@ RUN \ # for letsencrypt && touch /usr/local/vesta/data/queue/letsencrypt.pipe \ - + # setup redis like memcache && sed -i -e 's:^save:# save:g' \ -e 's:^bind:# bind:g' \ diff --git a/rootfs/etc/my_init.d/startup.sh b/rootfs/etc/my_init.d/startup.sh index 89f7ff3..062db89 100755 --- a/rootfs/etc/my_init.d/startup.sh +++ b/rootfs/etc/my_init.d/startup.sh @@ -1,6 +1,7 @@ #!/bin/bash export TERM=xterm +MYPASS= if [ ! -f /home/admin/bin/my-startup.sh ]; then echo "[i] running for the 1st time" @@ -12,6 +13,8 @@ if [ ! -f /home/admin/bin/my-startup.sh ]; then # save some bytes, you can do it later # rm -rf /sysprepz # rm -rf /vesta-start + + MYPASS=$( /etc/mysql/conf.d/down.cnf +echo "skip-grant-tables" >> /etc/mysql/conf.d/down.cnf + +MYSQL_ROOT_PASSWORD=$1 + +/etc/init.d/mysql restart + +# initialize users +mysql -uroot -e \ + "use mysql; \ + DELETE FROM mysql.user WHERE User='root' ; \ + FLUSH PRIVILEGES ; \ + CREATE USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ;\ + GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ;\ + FLUSH PRIVILEGES ;\ + " + +rm -f /etc/mysql/conf.d/down.cnf + +/etc/init.d/mysql restart + +exit 0 \ No newline at end of file