site command small fixes
- "-on" option now check if domain exists. - "-proxy" now check if is subdomain. - small changes in PMA install. - some small code improvements.
This commit is contained in:
parent
a040e8b9a5
commit
ebb06ccc42
|
@ -176,7 +176,6 @@ mysql_install() {
|
|||
# Generate mysql user passwords
|
||||
local AUTOGENPASS_ROOT=`pwgen -s -1`
|
||||
local AUTOGENPASS_ADMIN=`pwgen -s -1`
|
||||
local AUTOGENPASS_PMA=`pwgen -s -1`
|
||||
local enc_pass_root=$( echo $AUTOGENPASS_ROOT | openssl enc -a -salt )
|
||||
local enc_pass_admin=$( echo $AUTOGENPASS_ADMIN | openssl enc -a -salt )
|
||||
conf_write mysql-root $enc_pass_root
|
||||
|
@ -364,6 +363,7 @@ php_tool() {
|
|||
|
||||
mysql_tool() {
|
||||
#PhpMyAdmin unattended script installation
|
||||
local AUTOGENPASS_PMA=`pwgen -s -1`
|
||||
echo "phpmyadmin phpmyadmin/dbconfig-install boolean true" | debconf-set-selections
|
||||
echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect" | debconf-set-selections
|
||||
echo "phpmyadmin phpmyadmin/mysql/app-pass password $AUTOGENPASS_PMA" | debconf-set-selections
|
||||
|
@ -373,9 +373,7 @@ mysql_tool() {
|
|||
pre_install
|
||||
sudo apt-get -y install phpmyadmin
|
||||
|
||||
if [[ -d /usr/share/phpmyadmin ]]; then
|
||||
sudo mv /usr/share/phpmyadmin /var/www/$(conf_read tools-port)/htdocs/pma
|
||||
fi
|
||||
[[ -d /usr/share/phpmyadmin ]] && sudo mv /usr/share/phpmyadmin /var/www/$(conf_read tools-port)/htdocs/pma
|
||||
|
||||
conf_write mysql-tool true
|
||||
}
|
||||
|
|
14
plugins/site
14
plugins/site
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Site Manager Plugin (Create, delete and de/activate)
|
||||
# Syntax: site <domain> <option> <argument>
|
||||
# Options: -html, -php, -mysql, -wp, -wpsubdir, -wpsubdom, -parked, -on, -off, -delete, -delete-all, -list, -nocache, -cache, -ssl-on, ssl-off
|
||||
# Options: -html, -php, -mysql, -wp, -wpsubdir, -wpsubdom, -parked, -proxy, -on, -off, -delete, -delete-all, -list, -nocache, -cache, -ssl-on, ssl-off
|
||||
# Arguments: -cache, -root, -subdomain
|
||||
|
||||
# shopt is necessary for this kind !(html|22222) of patterns
|
||||
|
@ -42,7 +42,7 @@ fi
|
|||
|
||||
|
||||
# Check if site is sub-domain
|
||||
if [[ -n $domain && $type =~ ^(-html|-php|-mysql|-wp|-wpsubdir|-wpsubdom|-parked)$ ]]; then
|
||||
if [[ -n $domain && $type =~ ^(-html|-php|-mysql|-wp|-wpsubdir|-wpsubdom|-parked|-proxy)$ ]]; then
|
||||
count=1
|
||||
while true; do
|
||||
tld=$(echo "${domain}" | rev | cut -d'.' -f -$count -s | rev)
|
||||
|
@ -260,7 +260,7 @@ elif [[ "$type" == "-off" && -L /etc/nginx/sites-enabled/$domain ]]; then
|
|||
# Site re-enabled
|
||||
elif [[ "$type" == "-on" && -L /etc/nginx/sites-enabled/$domain ]]; then
|
||||
echo "${gre}Site $domain is already enabled!${end}"
|
||||
elif [[ "$type" == "-on" && ! -L /etc/nginx/sites-enabled/$domain ]]; then
|
||||
elif [[ "$type" == "-on" && ! -L /etc/nginx/sites-enabled/$domain && -a /etc/nginx/sites-available/$domain ]]; then
|
||||
sudo ln -s /etc/nginx/sites-available/$domain /etc/nginx/sites-enabled/$domain
|
||||
echo "${gre}Site $domain has been successfully enabled!${end}"
|
||||
|
||||
|
@ -330,15 +330,11 @@ elif [[ "$type" == "-cache" && -a /etc/nginx/sites-available/$domain ]]; then
|
|||
|
||||
|
||||
# Catch ERROR
|
||||
elif [[ ! -a /etc/nginx/sites-available/$domain && ( "$type" == "-nocache" || "$type" == "-cache" || "$type" == "-delete" || "$type" == "-on" || "$type" == "-ssl-on" || "$type" == "-ssl-off" ) ]]; then
|
||||
elif [[ ! -a /etc/nginx/sites-available/$domain && $type =~ ^(-nocache|-cache|-delete|-off|-on|-ssl-on|-ssl-off)$ ]]; then
|
||||
echo "${red}Site $domain doesn't exists!${end}"
|
||||
else
|
||||
echo "${red} Argument '${type}' is not a valid option! ${end}"
|
||||
fi
|
||||
|
||||
shopt -u extglob
|
||||
|
||||
|
||||
if [[ $(conf_read nginx) == "true" ]]; then
|
||||
sudo service nginx reload
|
||||
fi
|
||||
[[ $(conf_read nginx) == "true" ]] && sudo service nginx reload
|
||||
|
|
Loading…
Reference in a new issue