preparation for verbose output of shell commands (called by function exe())

This commit is contained in:
2019-04-10 12:33:34 +01:00
parent 4c50382428
commit 98469b1d20
4 changed files with 62 additions and 62 deletions

View File

@@ -10,11 +10,11 @@ phpPackages="${phpName}-fpm ${phpName}-json ${phpName}-mysql ${phpName}-curl ${p
step_1_info() { echo -e "Installation of $serverName and ${databaseName} packages:\n $serverPackages $databasePackages"; }
step_1_alias() { ALIAS=install; }
step_1() {
apt update
apt install $databasePackages
exe apt update
exe apt install $databasePackages
saveReturn $?
endReturn
apt install $serverPackages
exe apt install $serverPackages
saveReturn $?
}
@@ -29,11 +29,11 @@ step_2() {
# try fix errors on first install attempt
# (possible missing ipv6 support on system)
if [ $ERNO -ne 0 ] ; then
apt install nginx
exe apt install nginx
fi
# create webroot
mkdir -p "$siteLetsencryptWww"
exe mkdir -p "$siteLetsencryptWww"
echo -n "Restarting Nginx ... "
service nginx restart && echo "ok"
@@ -57,7 +57,7 @@ siteDefaultIp4="server {
step_3_info() { echo "Secure mariadb installation"; }
step_3() {
mysql_secure_installation
exe mysql_secure_installation
}
step_4_info() { echo "Mariadb configuration"; }
@@ -81,7 +81,7 @@ lower_case_table_names=0
step_5_info() { echo -e "Installation of $phpName packages:\n $phpPackages"; }
step_5() {
apt install $phpPackages
exe apt install $phpPackages
}
phpFpmConfigLocation="/etc/php/7.0/fpm/conf.d/90-custom_pi.ini"
@@ -122,30 +122,30 @@ step_10() {
local mysqlPass
echo "Existing mysql databases:"
mysql -u root -e 'SHOW DATABASES;'
exe mysql -u root -e 'SHOW DATABASES;'
read -p "Enter database name: " mysqlDatabase
endCheckEmpty mysqlDatabase "database name"
mysql -u root -e 'CREATE DATABASE '$mysqlDatabase';'
exe mysql -u root -e 'CREATE DATABASE '$mysqlDatabase';'
saveReturn $?
endReturn
echo "Existing mysql user:"
mysql -u root -e 'SELECT User, Host FROM mysql.user;'
exe mysql -u root -e 'SELECT User, Host FROM mysql.user;'
read -p "Enter mysql user name: " mysqlUser
endCheckEmpty mysqlDatabase "user name"
read -p "Enter mysql user password: " mysqlPass
endCheckEmpty mysqlPass "password"
mysql -u root -e 'CREATE USER '"'"$mysqlUser"'"'@'"'"'localhost'"'"' IDENTIFIED BY '"'"$mysqlPass"'"';'
exe mysql -u root -e 'CREATE USER '"'"$mysqlUser"'"'@'"'"'localhost'"'"' IDENTIFIED BY '"'"$mysqlPass"'"';'
saveReturn $?
endReturn
mysql -u root -e 'GRANT ALL PRIVILEGES ON '$mysqlDatabase'.* TO '"'"$mysqlUser"'"'@'"'"'localhost'"'"';'
exe mysql -u root -e 'GRANT ALL PRIVILEGES ON '$mysqlDatabase'.* TO '"'"$mysqlUser"'"'@'"'"'localhost'"'"';'
saveReturn $?
endReturn
mysql -u root -e 'FLUSH PRIVILEGES;'
exe mysql -u root -e 'FLUSH PRIVILEGES;'
}
step_12_info() { echo -e "Create mysql database with characterset utf8mb4\n"; }
@@ -156,30 +156,30 @@ step_12() {
local mysqlPass
echo "Existing mysql databases:"
mysql -u root -e 'SHOW DATABASES;'
exe mysql -u root -e 'SHOW DATABASES;'
read -p "Enter database name: " mysqlDatabase
endCheckEmpty mysqlDatabase "database name"
mysql -u root -e 'CREATE DATABASE '$mysqlDatabase' CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'
exe mysql -u root -e 'CREATE DATABASE '$mysqlDatabase' CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'
saveReturn $?
endReturn
echo "Existing mysql user:"
mysql -u root -e 'SELECT User, Host FROM mysql.user;'
exe mysql -u root -e 'SELECT User, Host FROM mysql.user;'
read -p "Enter mysql user name: " mysqlUser
endCheckEmpty mysqlDatabase "user name"
read -p "Enter mysql user password: " mysqlPass
endCheckEmpty mysqlPass "password"
mysql -u root -e 'CREATE USER '"'"$mysqlUser"'"'@'"'"'localhost'"'"' IDENTIFIED BY '"'"$mysqlPass"'"';'
exe mysql -u root -e 'CREATE USER '"'"$mysqlUser"'"'@'"'"'localhost'"'"' IDENTIFIED BY '"'"$mysqlPass"'"';'
saveReturn $?
endReturn
mysql -u root -e 'GRANT ALL PRIVILEGES ON '$mysqlDatabase'.* TO '"'"$mysqlUser"'"'@'"'"'localhost'"'"';'
exe mysql -u root -e 'GRANT ALL PRIVILEGES ON '$mysqlDatabase'.* TO '"'"$mysqlUser"'"'@'"'"'localhost'"'"';'
saveReturn $?
endReturn
mysql -u root -e 'FLUSH PRIVILEGES;'
exe mysql -u root -e 'FLUSH PRIVILEGES;'
}
VERSION_SEQREV=2