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

@@ -12,28 +12,28 @@ librePackages="fping git graphviz imagemagick mtr-tiny nmap python-memcache pyth
step_1_info() { echo "Updating apt"; }
step_1_alias() { ALIAS="install"; }
step_1() {
apt update
exe apt update
}
step_2_info() { echo -e "Installing $toolname dependencies: $librePackages"; }
step_2() {
apt install $librePackages
exe apt install $librePackages
saveReturn $?
endReturn
}
step_3_info() { echo -e "Installing -t buster PHP related packages:\n $librePhpDeps"; }
step_3() {
apt -t buster install $librePhpDeps
exe apt -t buster install $librePhpDeps
saveReturn $?
endReturn
}
step_4_info() { echo "Adding $toolName user (librenms:librenms)"; }
step_4() {
useradd librenms -d /opt/librenms -M -r
exe useradd librenms -d /opt/librenms -M -r
saveReturn $?
usermod -a -G librenms www-data
exe usermod -a -G librenms www-data
saveReturn $?
endReturn
}
@@ -41,7 +41,7 @@ step_4() {
step_5_info() { echo "Installing $toolName using composer"; }
step_5() {
cd /opt
composer create-project --no-dev --keep-vcs librenms/librenms librenms dev-master
exe composer create-project --no-dev --keep-vcs librenms/librenms librenms dev-master
saveReturn $?
endReturn
}
@@ -53,17 +53,17 @@ step_10() {
local mysqlPass
echo "Existing mysql databases:"
mysql -u root -e 'SHOW DATABASES;'
exe mysql -u root -e 'SHOW DATABASES;'
echo -en "Enter database name: "
read mysqlDatabase
endCheckEmpty mysqlDatabase "database name"
mysql -u root -e 'CREATE DATABASE '$mysqlDatabase' CHARACTER SET utf8 COLLATE utf8_unicode_ci;'
exe mysql -u root -e 'CREATE DATABASE '$mysqlDatabase' CHARACTER SET utf8 COLLATE utf8_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;'
echo -en "Enter mysql user name: "
read mysqlUser
endCheckEmpty mysqlDatabase "user name"
@@ -71,15 +71,15 @@ step_10() {
echo -en "Enter mysql user password: "
read 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_11_info() { echo "MariaDB configuration"; }
@@ -129,9 +129,9 @@ step_40() {
step_42_info() { echo "Fix librenms permission"; }
step_42_alias() { ALIAS="repair"; }
step_42() {
chown -R librenms:librenms /opt/librenms
setfacl -d -m g::rwx /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/logs /opt/librenms/rrd
chmod -R ug=rwX /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/logs /opt/librenms/rrd
exe chown -R librenms:librenms /opt/librenms
exe setfacl -d -m g::rwx /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/logs /opt/librenms/rrd
exe chmod -R ug=rwX /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/logs /opt/librenms/rrd
}
# Sequence Revision