-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·32 lines (30 loc) · 1.22 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# f1ag is 1nst@all_it
if [ ! "$BASH_VERSION" ] ; then
bash install.sh;
exit 0;
fi;
echo "Welcome to teendevops!";
echo -n "Please enter the MySQL host (default: localhost):";
read host;
host=${host:-localhost};
echo -n "Please enter the MySQL username:";
read username;
echo -n "Please enter the MySQL password:";
read -s password;
echo;
rm includes/config.php 2>/dev/null || true;
cp includes/config.php.example includes/config.php 2>/dev/null || true;
chmod 740 includes/config.php;
sed "s/\"DATABASE_USER\", \"\"/\"DATABASE_USER\", \"$username\"/g" includes/config.php > includes/config_change.php;
mv includes/config_change.php includes/config.php;
sed "s/\"DATABASE_PASS\", \"\"/\"DATABASE_PASS\", \"$password\"/g" includes/config.php > includes/config_change.php;
mv includes/config_change.php includes/config.php;
sed "s/\"DATABASE_HOST\", \"localhost\"/\"DATABASE_HOST\", \"$host\"/g" includes/config.php > includes/config_change.php;
mv includes/config_change.php includes/config.php;
mysql -u "$(echo $username)" -p"$(echo $password)" < ./teendevops.sql;
echo "Configuration complete. For further configuration options, check the config file includes/config.php";
unset username;
unset password;
unset host;
exit 0;