fix check for root user, set noninteractive

This commit is contained in:
Matthew Saunders Brown 2022-10-17 12:25:25 -07:00
parent 0582919f0d
commit 3db90e3f7f

View File

@ -6,7 +6,7 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# #
# must be root # must be root
if [ "$USER" != "root" ]; then if [ "${EUID}" -ne 0 ]; then
echo "You must be root to run this installer." echo "You must be root to run this installer."
exit exit
fi fi
@ -47,10 +47,10 @@ dbuser=`grep -m 1 user /var/vmail/.my.cnf |cut -d = -f 2|cut -d ' ' -f 2`
dbpass=`grep -m 1 password /var/vmail/.my.cnf |cut -d = -f 2|cut -d ' ' -f 2` dbpass=`grep -m 1 password /var/vmail/.my.cnf |cut -d = -f 2|cut -d ' ' -f 2`
sed -i "s|.*db_dsnw.*|\$config['db_dsnw'] = 'mysql://$dbuser:$dbpass@$dbhost/$dbdatabase';|g" /srv/www/html/roundcube/config/config.inc.php sed -i "s|.*db_dsnw.*|\$config['db_dsnw'] = 'mysql://$dbuser:$dbpass@$dbhost/$dbdatabase';|g" /srv/www/html/roundcube/config/config.inc.php
apt-get update DEBIAN_FRONTEND=noninteractive apt-get -y update
# make sure pwgen is installed # make sure pwgen is installed
apt-get -qq -y install pwgen DEBIAN_FRONTEND=noninteractive apt-get -qq -y install pwgen
# create random key # create random key
des_key=`pwgen -1 24` des_key=`pwgen -1 24`