Revize 5898e047
Přidáno uživatelem David Raška před asi 11 roky(ů)
install.sh | ||
---|---|---|
exit 1
|
||
fi
|
||
|
||
# get user name
|
||
while [ true ]
|
||
do
|
||
read -p "DB user name: " user
|
||
|
||
if [ -n "$user" ]
|
||
then
|
||
break
|
||
fi
|
||
done
|
||
|
||
# get password
|
||
read -sp "DB user password: " pass
|
||
echo
|
||
|
||
# get server
|
||
read -p "DB server (default localhost): " server
|
||
|
||
if [ -z "$server" ]
|
||
if [[ "$1" == "-u" ]];
|
||
then
|
||
server="localhost"
|
||
echo "Uninstalling"
|
||
rm -rf /var/www/freenetis-addresses
|
||
rm -f /etc/freenetis-addresses.ini
|
||
exit 1
|
||
fi
|
||
|
||
# get port
|
||
read -p "DB port (default 3306): " port
|
||
|
||
if [ -z "$port" ]
|
||
if [ ! -r /etc/freenetis-addresses.ini ]
|
||
then
|
||
port="3306"
|
||
fi
|
||
# get user name
|
||
while [ true ]
|
||
do
|
||
read -p "DB user name: " user
|
||
|
||
# get database
|
||
read -p "DB database (default addresses): " db
|
||
|
||
if [ -z "$db" ]
|
||
then
|
||
db="addresses"
|
||
fi
|
||
if [ -n "$user" ]
|
||
then
|
||
break
|
||
fi
|
||
done
|
||
|
||
# get password
|
||
read -sp "DB user password: " pass
|
||
echo
|
||
|
||
# get server
|
||
read -p "DB server (default localhost): " server
|
||
|
||
if [ -z "$server" ]
|
||
then
|
||
server="localhost"
|
||
fi
|
||
|
||
# get port
|
||
read -p "DB port (default 3306): " port
|
||
|
||
if [ -z "$port" ]
|
||
then
|
||
port="3306"
|
||
fi
|
||
|
||
echo "Saving configuration"
|
||
# get database
|
||
read -p "DB database (default addresses): " db
|
||
|
||
# save configuration
|
||
echo mysql_user=$user > /etc/freenetis-addresses.ini
|
||
echo mysql_pass=$pass >> /etc/freenetis-addresses.ini
|
||
echo mysql_server=$server >> /etc/freenetis-addresses.ini
|
||
echo mysql_port=$port >> /etc/freenetis-addresses.ini
|
||
echo mysql_db=$db >> /etc/freenetis-addresses.ini
|
||
if [ -z "$db" ]
|
||
then
|
||
db="addresses"
|
||
fi
|
||
|
||
echo "Saving configuration"
|
||
|
||
# save configuration
|
||
echo mysql_user=$user > /etc/freenetis-addresses.ini
|
||
echo mysql_pass=$pass >> /etc/freenetis-addresses.ini
|
||
echo mysql_server=$server >> /etc/freenetis-addresses.ini
|
||
echo mysql_port=$port >> /etc/freenetis-addresses.ini
|
||
echo mysql_db=$db >> /etc/freenetis-addresses.ini
|
||
fi
|
||
|
||
echo "Installing"
|
||
|
||
# install
|
||
rm -rf /var/www/freenetis-addresses
|
||
mkdir /var/www/freenetis-addresses
|
||
|
||
cp ./index.php /var/www/freenetis-addresses/
|
Také k dispozici: Unified diff
Changes:
- Added CREATE DATABASE witch correct encoding
- Install script do not require db info every time
- New -u parameter in install script to uninstall