preparation for verbose output of shell commands (called by function exe())
This commit is contained in:
@@ -10,20 +10,20 @@ giteaServiceLoc="/etc/systemd/system/gitea.service"
|
|||||||
|
|
||||||
step_1_info() { echo "Updating apt"; }
|
step_1_info() { echo "Updating apt"; }
|
||||||
step_1() {
|
step_1() {
|
||||||
apt update
|
exe apt update
|
||||||
}
|
}
|
||||||
|
|
||||||
step_2_info() { echo "Downloading $toolName to user home: $giteaDownload"; }
|
step_2_info() { echo "Downloading $toolName to user home: $giteaDownload"; }
|
||||||
step_2() {
|
step_2() {
|
||||||
cd
|
exe cd ~
|
||||||
wget -O gitea $giteaDownload
|
exe wget -O gitea $giteaDownload
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
}
|
}
|
||||||
|
|
||||||
step_3_info() { echo "Adding user for $toolName (git:git)"; }
|
step_3_info() { echo "Adding user for $toolName (git:git)"; }
|
||||||
step_3() {
|
step_3() {
|
||||||
adduser \
|
exe adduser \
|
||||||
--system \
|
--system \
|
||||||
--shell /bin/bash \
|
--shell /bin/bash \
|
||||||
--gecos 'Git Version Control' \
|
--gecos 'Git Version Control' \
|
||||||
@@ -38,14 +38,14 @@ step_3() {
|
|||||||
step_4_info() { echo "Create required directory structure"; }
|
step_4_info() { echo "Create required directory structure"; }
|
||||||
step_4() {
|
step_4() {
|
||||||
mkdir -p /var/lib/gitea/{custom,data,log}
|
mkdir -p /var/lib/gitea/{custom,data,log}
|
||||||
chown -R git: /var/lib/gitea/
|
exe chown -R git: /var/lib/gitea/
|
||||||
chmod -R 750 /var/lib/gitea/
|
exe chmod -R 750 /var/lib/gitea/
|
||||||
mkdir /etc/gitea
|
mkdir /etc/gitea
|
||||||
chown root:git /etc/gitea
|
exe chown root:git /etc/gitea
|
||||||
chmod 770 /etc/gitea
|
exe chmod 770 /etc/gitea
|
||||||
echo "Copying gitea to global location and making it executable"
|
echo "Copying gitea to global location and making it executable"
|
||||||
chmod +x ~/gitea
|
exe chmod +x ~/gitea
|
||||||
cp ~/gitea /usr/local/bin/gitea
|
exe cp ~/gitea /usr/local/bin/gitea
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
}
|
}
|
||||||
@@ -60,8 +60,8 @@ step_5() {
|
|||||||
|
|
||||||
step_6_info() { echo -e "Starting $toolName service\n"; }
|
step_6_info() { echo -e "Starting $toolName service\n"; }
|
||||||
step_6() {
|
step_6() {
|
||||||
systemctl enable gitea
|
exe systemctl enable gitea
|
||||||
systemctl start gitea
|
exe systemctl start gitea
|
||||||
echo "Before proceeding to installation you may need to create a database first with step 10"
|
echo "Before proceeding to installation you may need to create a database first with step 10"
|
||||||
echo
|
echo
|
||||||
echo "Goto http://[yourip]:3000/install and complete installation"
|
echo "Goto http://[yourip]:3000/install and complete installation"
|
||||||
@@ -77,17 +77,17 @@ step_10() {
|
|||||||
local mysqlPass
|
local mysqlPass
|
||||||
|
|
||||||
echo "Existing mysql databases:"
|
echo "Existing mysql databases:"
|
||||||
mysql -u root -e 'SHOW DATABASES;'
|
exe mysql -u root -e 'SHOW DATABASES;'
|
||||||
|
|
||||||
echo -en "Enter database name: "
|
echo -en "Enter database name: "
|
||||||
read mysqlDatabase
|
read mysqlDatabase
|
||||||
endCheckEmpty mysqlDatabase "database name"
|
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 $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
|
|
||||||
echo "Existing mysql user:"
|
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: "
|
echo -en "Enter mysql user name: "
|
||||||
read mysqlUser
|
read mysqlUser
|
||||||
endCheckEmpty mysqlDatabase "user name"
|
endCheckEmpty mysqlDatabase "user name"
|
||||||
@@ -95,21 +95,21 @@ step_10() {
|
|||||||
echo -en "Enter mysql user password: "
|
echo -en "Enter mysql user password: "
|
||||||
read mysqlPass
|
read mysqlPass
|
||||||
endCheckEmpty mysqlPass "password"
|
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 $?
|
saveReturn $?
|
||||||
endReturn
|
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 $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
|
|
||||||
mysql -u root -e 'FLUSH PRIVILEGES;'
|
exe mysql -u root -e 'FLUSH PRIVILEGES;'
|
||||||
}
|
}
|
||||||
|
|
||||||
step_20_info() { echo "Secure settings after installation"; }
|
step_20_info() { echo "Secure settings after installation"; }
|
||||||
step_20() {
|
step_20() {
|
||||||
chmod 750 /etc/gitea
|
exe chmod 750 /etc/gitea
|
||||||
chmod 644 /etc/gitea/app.ini
|
exe chmod 644 /etc/gitea/app.ini
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sequence Revision
|
# Sequence Revision
|
||||||
|
@@ -12,28 +12,28 @@ librePackages="fping git graphviz imagemagick mtr-tiny nmap python-memcache pyth
|
|||||||
step_1_info() { echo "Updating apt"; }
|
step_1_info() { echo "Updating apt"; }
|
||||||
step_1_alias() { ALIAS="install"; }
|
step_1_alias() { ALIAS="install"; }
|
||||||
step_1() {
|
step_1() {
|
||||||
apt update
|
exe apt update
|
||||||
}
|
}
|
||||||
|
|
||||||
step_2_info() { echo -e "Installing $toolname dependencies: $librePackages"; }
|
step_2_info() { echo -e "Installing $toolname dependencies: $librePackages"; }
|
||||||
step_2() {
|
step_2() {
|
||||||
apt install $librePackages
|
exe apt install $librePackages
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
}
|
}
|
||||||
|
|
||||||
step_3_info() { echo -e "Installing -t buster PHP related packages:\n $librePhpDeps"; }
|
step_3_info() { echo -e "Installing -t buster PHP related packages:\n $librePhpDeps"; }
|
||||||
step_3() {
|
step_3() {
|
||||||
apt -t buster install $librePhpDeps
|
exe apt -t buster install $librePhpDeps
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
}
|
}
|
||||||
|
|
||||||
step_4_info() { echo "Adding $toolName user (librenms:librenms)"; }
|
step_4_info() { echo "Adding $toolName user (librenms:librenms)"; }
|
||||||
step_4() {
|
step_4() {
|
||||||
useradd librenms -d /opt/librenms -M -r
|
exe useradd librenms -d /opt/librenms -M -r
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
usermod -a -G librenms www-data
|
exe usermod -a -G librenms www-data
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ step_4() {
|
|||||||
step_5_info() { echo "Installing $toolName using composer"; }
|
step_5_info() { echo "Installing $toolName using composer"; }
|
||||||
step_5() {
|
step_5() {
|
||||||
cd /opt
|
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 $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
}
|
}
|
||||||
@@ -53,17 +53,17 @@ step_10() {
|
|||||||
local mysqlPass
|
local mysqlPass
|
||||||
|
|
||||||
echo "Existing mysql databases:"
|
echo "Existing mysql databases:"
|
||||||
mysql -u root -e 'SHOW DATABASES;'
|
exe mysql -u root -e 'SHOW DATABASES;'
|
||||||
|
|
||||||
echo -en "Enter database name: "
|
echo -en "Enter database name: "
|
||||||
read mysqlDatabase
|
read mysqlDatabase
|
||||||
endCheckEmpty mysqlDatabase "database name"
|
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 $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
|
|
||||||
echo "Existing mysql user:"
|
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: "
|
echo -en "Enter mysql user name: "
|
||||||
read mysqlUser
|
read mysqlUser
|
||||||
endCheckEmpty mysqlDatabase "user name"
|
endCheckEmpty mysqlDatabase "user name"
|
||||||
@@ -71,15 +71,15 @@ step_10() {
|
|||||||
echo -en "Enter mysql user password: "
|
echo -en "Enter mysql user password: "
|
||||||
read mysqlPass
|
read mysqlPass
|
||||||
endCheckEmpty mysqlPass "password"
|
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 $?
|
saveReturn $?
|
||||||
endReturn
|
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 $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
|
|
||||||
mysql -u root -e 'FLUSH PRIVILEGES;'
|
exe mysql -u root -e 'FLUSH PRIVILEGES;'
|
||||||
}
|
}
|
||||||
|
|
||||||
step_11_info() { echo "MariaDB configuration"; }
|
step_11_info() { echo "MariaDB configuration"; }
|
||||||
@@ -129,9 +129,9 @@ step_40() {
|
|||||||
step_42_info() { echo "Fix librenms permission"; }
|
step_42_info() { echo "Fix librenms permission"; }
|
||||||
step_42_alias() { ALIAS="repair"; }
|
step_42_alias() { ALIAS="repair"; }
|
||||||
step_42() {
|
step_42() {
|
||||||
chown -R librenms:librenms /opt/librenms
|
exe chown -R librenms:librenms /opt/librenms
|
||||||
setfacl -d -m g::rwx /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/logs /opt/librenms/rrd
|
exe 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 chmod -R ug=rwX /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/logs /opt/librenms/rrd
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sequence Revision
|
# Sequence Revision
|
||||||
|
@@ -8,14 +8,14 @@ step_1() {
|
|||||||
local sourceList="/etc/apt/sources.list.d/tvheadend.list"
|
local sourceList="/etc/apt/sources.list.d/tvheadend.list"
|
||||||
local sourceEntry="deb https://apt.tvheadend.org/stable raspbian-stretch main"
|
local sourceEntry="deb https://apt.tvheadend.org/stable raspbian-stretch main"
|
||||||
|
|
||||||
apt update
|
exe apt update
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
apt install coreutils wget apt-transport-https ca-certificates
|
exe apt install coreutils wget apt-transport-https ca-certificates
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
|
|
||||||
echo -n "Downloading tvheadend repository key ... "
|
echo -n "Downloading tvheadend repository key ... "
|
||||||
wget -qO- https://doozer.io/keys/tvheadend/tvheadend/pgp | sudo apt-key add -
|
exe wget -qO- https://doozer.io/keys/tvheadend/tvheadend/pgp | sudo apt-key add -
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
|
|
||||||
@@ -24,9 +24,9 @@ step_1() {
|
|||||||
|
|
||||||
step_2_info() { echo "Install/Upate $toolName"; }
|
step_2_info() { echo "Install/Upate $toolName"; }
|
||||||
step_2() {
|
step_2() {
|
||||||
apt update
|
exe apt update
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
apt install tvheadend
|
exe apt install tvheadend
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
|
|
||||||
@@ -39,14 +39,14 @@ step_99() {
|
|||||||
local sourceList="/etc/apt/sources.list.d/tvheadend.list"
|
local sourceList="/etc/apt/sources.list.d/tvheadend.list"
|
||||||
local sourceEntry="deb https://dl.bintray.com/mpmc/deb raspbianstretch release-4.2"
|
local sourceEntry="deb https://dl.bintray.com/mpmc/deb raspbianstretch release-4.2"
|
||||||
|
|
||||||
apt update && apt install dirmngr
|
exe apt update && apt install dirmngr
|
||||||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61
|
exe apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61
|
||||||
if [ -f "$sourceList" ] ; then
|
if [ -f "$sourceList" ] ; then
|
||||||
echo "Skipping creating of $sourceList; Already exists"
|
echo "Skipping creating of $sourceList; Already exists"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
echo "$sourceEntry" > "$sourceList"
|
echo "$sourceEntry" > "$sourceList"
|
||||||
apt update
|
exe apt update
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
}
|
}
|
||||||
|
@@ -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_info() { echo -e "Installation of $serverName and ${databaseName} packages:\n $serverPackages $databasePackages"; }
|
||||||
step_1_alias() { ALIAS=install; }
|
step_1_alias() { ALIAS=install; }
|
||||||
step_1() {
|
step_1() {
|
||||||
apt update
|
exe apt update
|
||||||
apt install $databasePackages
|
exe apt install $databasePackages
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
apt install $serverPackages
|
exe apt install $serverPackages
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,11 +29,11 @@ step_2() {
|
|||||||
# try fix errors on first install attempt
|
# try fix errors on first install attempt
|
||||||
# (possible missing ipv6 support on system)
|
# (possible missing ipv6 support on system)
|
||||||
if [ $ERNO -ne 0 ] ; then
|
if [ $ERNO -ne 0 ] ; then
|
||||||
apt install nginx
|
exe apt install nginx
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create webroot
|
# create webroot
|
||||||
mkdir -p "$siteLetsencryptWww"
|
exe mkdir -p "$siteLetsencryptWww"
|
||||||
|
|
||||||
echo -n "Restarting Nginx ... "
|
echo -n "Restarting Nginx ... "
|
||||||
service nginx restart && echo "ok"
|
service nginx restart && echo "ok"
|
||||||
@@ -57,7 +57,7 @@ siteDefaultIp4="server {
|
|||||||
|
|
||||||
step_3_info() { echo "Secure mariadb installation"; }
|
step_3_info() { echo "Secure mariadb installation"; }
|
||||||
step_3() {
|
step_3() {
|
||||||
mysql_secure_installation
|
exe mysql_secure_installation
|
||||||
}
|
}
|
||||||
|
|
||||||
step_4_info() { echo "Mariadb configuration"; }
|
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_info() { echo -e "Installation of $phpName packages:\n $phpPackages"; }
|
||||||
step_5() {
|
step_5() {
|
||||||
apt install $phpPackages
|
exe apt install $phpPackages
|
||||||
}
|
}
|
||||||
|
|
||||||
phpFpmConfigLocation="/etc/php/7.0/fpm/conf.d/90-custom_pi.ini"
|
phpFpmConfigLocation="/etc/php/7.0/fpm/conf.d/90-custom_pi.ini"
|
||||||
@@ -122,30 +122,30 @@ step_10() {
|
|||||||
local mysqlPass
|
local mysqlPass
|
||||||
|
|
||||||
echo "Existing mysql databases:"
|
echo "Existing mysql databases:"
|
||||||
mysql -u root -e 'SHOW DATABASES;'
|
exe mysql -u root -e 'SHOW DATABASES;'
|
||||||
|
|
||||||
read -p "Enter database name: " mysqlDatabase
|
read -p "Enter database name: " mysqlDatabase
|
||||||
endCheckEmpty mysqlDatabase "database name"
|
endCheckEmpty mysqlDatabase "database name"
|
||||||
mysql -u root -e 'CREATE DATABASE '$mysqlDatabase';'
|
exe mysql -u root -e 'CREATE DATABASE '$mysqlDatabase';'
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
|
|
||||||
echo "Existing mysql user:"
|
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
|
read -p "Enter mysql user name: " mysqlUser
|
||||||
endCheckEmpty mysqlDatabase "user name"
|
endCheckEmpty mysqlDatabase "user name"
|
||||||
|
|
||||||
read -p "Enter mysql user password: " mysqlPass
|
read -p "Enter mysql user password: " mysqlPass
|
||||||
endCheckEmpty mysqlPass "password"
|
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 $?
|
saveReturn $?
|
||||||
endReturn
|
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 $?
|
saveReturn $?
|
||||||
endReturn
|
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"; }
|
step_12_info() { echo -e "Create mysql database with characterset utf8mb4\n"; }
|
||||||
@@ -156,30 +156,30 @@ step_12() {
|
|||||||
local mysqlPass
|
local mysqlPass
|
||||||
|
|
||||||
echo "Existing mysql databases:"
|
echo "Existing mysql databases:"
|
||||||
mysql -u root -e 'SHOW DATABASES;'
|
exe mysql -u root -e 'SHOW DATABASES;'
|
||||||
|
|
||||||
read -p "Enter database name: " mysqlDatabase
|
read -p "Enter database name: " mysqlDatabase
|
||||||
endCheckEmpty mysqlDatabase "database name"
|
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 $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
|
|
||||||
echo "Existing mysql user:"
|
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
|
read -p "Enter mysql user name: " mysqlUser
|
||||||
endCheckEmpty mysqlDatabase "user name"
|
endCheckEmpty mysqlDatabase "user name"
|
||||||
|
|
||||||
read -p "Enter mysql user password: " mysqlPass
|
read -p "Enter mysql user password: " mysqlPass
|
||||||
endCheckEmpty mysqlPass "password"
|
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 $?
|
saveReturn $?
|
||||||
endReturn
|
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 $?
|
saveReturn $?
|
||||||
endReturn
|
endReturn
|
||||||
|
|
||||||
mysql -u root -e 'FLUSH PRIVILEGES;'
|
exe mysql -u root -e 'FLUSH PRIVILEGES;'
|
||||||
}
|
}
|
||||||
|
|
||||||
VERSION_SEQREV=2
|
VERSION_SEQREV=2
|
||||||
|
Reference in New Issue
Block a user