summarylogtreecommitdiffstats
path: root/setdb.sh
diff options
context:
space:
mode:
authoryhfudev2017-11-05 22:18:21 -0500
committeryhfudev2017-11-05 22:18:21 -0500
commit3797711e46cde7bdefd771cda875085e03e76af2 (patch)
treee67f6b44d120c5e28915ab43636857cb60e493f3 /setdb.sh
downloadaur-esniper-web.tar.gz
Initial import
Diffstat (limited to 'setdb.sh')
-rwxr-xr-xsetdb.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/setdb.sh b/setdb.sh
new file mode 100755
index 000000000000..69eaaa38b6b1
--- /dev/null
+++ b/setdb.sh
@@ -0,0 +1,40 @@
+
+setup() {
+ #ln -s /usr/share/webapps/esniper /srv/http/
+
+ # enable extension=pdo_mysql.so in file /etc/php/php.ini
+ # systemctl restart php-fpm
+
+ DBNAME=root
+ DBUSER=root
+ DBPASS=root
+
+ printf "Input Database(MySQL) Username:"
+ read tmp
+ if test -n "$tmp"; then
+ DBUSER="$tmp"
+ fi
+ printf "Input Database(MySQL) Password:"
+ read tmp
+ if test -n "$tmp"; then
+ DBPASS="$tmp"
+ fi
+ DBNAME="${DBUSER}"
+
+ sed -i "s/\"EZSQL_DB_NAME\", \"snyp\"/\"EZSQL_DB_NAME\", \"$DBNAME\"/g" /usr/share/webapps/esniper/config.inc.php
+ sed -i "s/\"EZSQL_DB_USER\", \"snyp\"/\"EZSQL_DB_USER\", \"$DBUSER\"/g" /usr/share/webapps/esniper/config.inc.php
+ sed -i "s/\"EZSQL_DB_PASSWORD\", \"snyp\"/\"EZSQL_DB_PASSWORD\", \"$DBPASS\"/g" /usr/share/webapps/esniper/config.inc.php
+
+ chmod 700 /usr/share/webapps/esniper/config.inc.php
+ chown http:http /usr/share/webapps/esniper/config.inc.php
+
+
+ cp /usr/share/webapps/esniper/install/esniper.sql /tmp/tmp-esniper-db.sql
+ sed -e "s|# phpMyAdmin SQL Dump|CREATE DATABASE IF NOT EXISTS ${DBNAME};\nuse ${DBNAME};\n|g" \
+ -i /tmp/tmp-esniper-db.sql
+
+ mysql -h localhost -u$DBUSER -p$DBPASS < /tmp/tmp-esniper-db.sql
+}
+
+setup
+