run.sh 1.69 KB
Newer Older
1 2 3 4
#!/bin/bash

error=0;

Sebastien's avatar
Sebastien committed
5 6 7
login=$1;


8 9 10
echo -e "\e[1m\e[100m";


11
if [ -z ${FC_DIR+x} ]
12
then 
13
	echo -e "\n\e[31m[ERROR] - FC_DIR is unset\e[39m";
14 15
	error=1;
else
16
	if [ ! -d $FC_DIR/ ]
17
	then
18
		echo -e "\n\e[31m[ERROR] - FC_DIR >$FC_DIR< DOES NOT EXIST\e[39m";
19 20 21 22
		error=1;
	fi
fi

23
if [ -z ${FC_ADMIN+x} ]
24
then 
25
	echo -e "\n\e[31m[ERROR] - FC_ADMIN is unset : MUST BE SET TO Admin email address\e[39m";
26 27 28
	error=1;
fi

29
if [ ! -e $FC_DIR/data/cfg/ssmtp.conf ]
30
then
31
	if [ -z ${FC_SMTP+x} ]
32
	then
33 34
		echo -e "\n\e[31m[ERROR] - FC_SMTP is unset and SSMTP not configured: >$FC_DIR/data/cfg/ssmtp.conf< DOES NOT EXIST";
		echo -e "\e[33m>>>> [HELP] - Set FC_SMTP to your SMTP server address and FC_SMTP_LOGIN and FC_SMTP_PASSWD if authentication is required\e[39m";
35 36 37 38
		error=1;
	fi
fi

39
if [ -z ${FC_PORT+x} ]
40
then 
41
	echo -e "\n\e[31m[ERROR] - FC_PORT is unset : MUST BE SET TO the port you want to access family-companion app\e[39m";
42 43 44
	error=1;
fi

45
if [ -z ${FC_HOSTNAME+x} ]
46
then
47 48
	echo -e "\e[33m>>>> [HELP] - FC_HOSTNAME not set - default setting is localhost\e[39m";
	FC_HOSTNAME='localhost';
49 50
fi

51 52
echo -e "portal_web_server=http://$FC_HOSTNAME\n" > $FC_DIR/data/cfg/env.cfg;
echo -e "portal_port=$FC_PORT\n" >>  $FC_DIR/data/cfg/env.cfg;
53

54 55
if [ $error -ne 1 ]
then
Sebastien's avatar
Sebastien committed
56 57 58 59 60 61
	interactive=' -d ';
	if [[ "$login" =~ (-login)$ ]]
	then
		interactive=' -i ';
	fi
	echo -e "\n\n\e[32mfamily-companion is running @ http://$HOSTNAME:$FC_PORT/family-companion\n\n\e[39m";
Sebastien's avatar
Sebastien committed
62
	docker run $interactive -p $FC_PORT:80 -p 587:587 -p 465:465 -p 25:25 -v $FC_DIR/data:/var/www/family-companion/data -v $FC_DIR/etc:/var/www/family-companion/etc -t bbric/family-companion
63 64 65 66 67
else
	echo -e "\n\n\e[31m[ERROR] - Service not started\n\n\e[39m";
fi


Sebastien's avatar
Sebastien committed
68

69 70
echo -e "\e[49m";
echo -e "\e[0m";