diff --git a/uber-standardsetup.sh b/uber-standardsetup.sh index cfe7049..9bd0805 100755 --- a/uber-standardsetup.sh +++ b/uber-standardsetup.sh @@ -1,7 +1,31 @@ +# uber-standardsetup.sh +# +# Copyright (C) 2015 Max Mehl +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# #!/bin/bash + SERVER=$(echo $HOSTNAME | sed -e 's/.uberspace.de//g') VIRTUAL=/var/www/virtual/$USER -MYSQLPASS=$(grep "password=" ~/.my.cnf | sed -e 's/password=//g' | sed -e 's/[ \t].*//g') +MYSQLPASS=$(awk '/^\[client\]/,/^password=/' ~/.my.cnf | grep "password=" | sed -e 's/password=//g' | sed -e 's/[ \t].*//g') + +# In older hosts, there's only 1 MySQL password and not 2 +if [ "$MYSQLPASS" == "" ]; then + MYSQLPASS=$(grep "password=" ~/.my.cnf | sed -e 's/password=//g' | sed -e 's/[ \t].*//g') +fi + read -p "Domain: " DOMAIN IP=$(curl -s curlmyip.com)