Add install script
This commit is contained in:
parent
026660aa2f
commit
30135b4c6e
2
misc/init_db.sql
Normal file
2
misc/init_db.sql
Normal file
@ -0,0 +1,2 @@
|
||||
DROP DATABASE IF EXISTS fic2014;
|
||||
CREATE DATABASE fic2014;
|
68
misc/install.sh
Executable file
68
misc/install.sh
Executable file
@ -0,0 +1,68 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Install FIC 2014 server
|
||||
|
||||
# Depends:
|
||||
#
|
||||
# nginx 1.4.3
|
||||
# openssh 6.3p1-1
|
||||
# iptables 1.4.19.1-1
|
||||
# mariadb 5.5.33.a-1
|
||||
|
||||
# Exit values
|
||||
# 0 Everything is good
|
||||
# 1
|
||||
# 2 File not found
|
||||
# 3 Service not running
|
||||
|
||||
# By default the config dir is ..
|
||||
DIR=${PWD%/*}
|
||||
CONF="server.conf"
|
||||
BASENAME=`basename $0`
|
||||
FULL_INSTALL=false
|
||||
|
||||
display_help()
|
||||
{
|
||||
# By default install only config files
|
||||
# --full: install package, enable services, install config
|
||||
echo "Usage: $BASENAME [--full] (alpha|beta)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
HTTP_DIR=""
|
||||
DB_TYPE=""
|
||||
DB_NAME=""
|
||||
DB_USER=""
|
||||
DB_PASS=""
|
||||
|
||||
parse_conf()
|
||||
{
|
||||
if ! [ -f $CONF ]; then
|
||||
echo "The configuration file: " $CONF " not found"
|
||||
exit 2
|
||||
fi
|
||||
HTTP_DIR=$(sed -n 's/[ \t]*http_root[ \t]*=[ \t]*\(.*\)[ \t]*/\1/p' $CONF)
|
||||
DB_TYPE=$(sed -n 's/[ \t]*db_type[ \t]*=[ \t]*\(.*\)[ \t]*/\1/p' $CONF)
|
||||
DB_NAME=$(sed -n 's/[ \t]*db_name[ \t]*=[ \t]*\(.*\)[ \t]*/\1/p' $CONF)
|
||||
DB_USER=$(sed -n 's/[ \t]*db_user[ \t]*=[ \t]*\(.*\)[ \t]*/\1/p' $CONF)
|
||||
DB_PASS=$(sed -n 's/[ \t]*db_pass[ \t]*=[ \t]*\(.*\)[ \t]*/\1/p' $CONF)
|
||||
}
|
||||
|
||||
INIT_DB="init_db.sql"
|
||||
|
||||
init_db()
|
||||
{
|
||||
if ! [ -f $INIT_DB ]; then
|
||||
echo "The configuration file " $INIT_DB " not found"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if ! [ -S /var/run/mysqld/mysqld.sock ]; then
|
||||
echo "The mysqld service is not running"
|
||||
exit 3
|
||||
fi
|
||||
}
|
||||
|
||||
[ $# -ne 1 ] && display_help
|
||||
|
||||
parse_conf
|
5
misc/server.conf
Normal file
5
misc/server.conf
Normal file
@ -0,0 +1,5 @@
|
||||
http_root=/srv/http/fic2014-server
|
||||
db_type=mysql
|
||||
db_name=fic
|
||||
db_user=toto
|
||||
db_pass=toto42
|
Loading…
Reference in New Issue
Block a user