Subversion Repositories ALCASAR

Rev

Rev 2661 | Rev 2665 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2661 Rev 2664
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-conf.sh 2661 2018-11-17 18:41:24Z lucas.echard $
2
# $Id: alcasar-conf.sh 2664 2018-11-19 17:35:12Z tom.houdayer $
3
 
3
 
4
# alcasar-conf.sh
4
# alcasar-conf.sh
5
# by REXY
5
# by REXY
6
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
7
 
7
 
Line 29... Line 29...
29
DHCP_mode=`grep ^DHCP= $CONF_FILE|cut -d"=" -f2`
29
DHCP_mode=`grep ^DHCP= $CONF_FILE|cut -d"=" -f2`
30
INT_DNS_mode=`grep ^INT_DNS_ACTIVE= $CONF_FILE|cut -d"=" -f2`
30
INT_DNS_mode=`grep ^INT_DNS_ACTIVE= $CONF_FILE|cut -d"=" -f2`
31
LDAP_mode=`grep ^LDAP= $CONF_FILE|cut -d"=" -f2`
31
LDAP_mode=`grep ^LDAP= $CONF_FILE|cut -d"=" -f2`
32
HOSTNAME=`grep ^HOSTNAME= $CONF_FILE|cut -d"=" -f2`
32
HOSTNAME=`grep ^HOSTNAME= $CONF_FILE|cut -d"=" -f2`
33
DOMAIN=`grep ^DOMAIN= $CONF_FILE|cut -d"=" -f2`
33
DOMAIN=`grep ^DOMAIN= $CONF_FILE|cut -d"=" -f2`
34
PASSWD_FILE="/root/ALCASAR-passwords.txt"
-
 
35
DB_USER=$(grep '^db_user=' $PASSWD_FILE | cut -d'=' -f 2-)
-
 
36
DB_PASS=$(grep '^db_password=' $PASSWD_FILE | cut -d'=' -f 2-)
-
 
37
SED="/bin/sed -i"
34
SED="/bin/sed -i"
38
DNS1=`grep ^DNS1= $CONF_FILE | cut -d'=' -f2`                   # server DNS1 (for WL domain names)
35
DNS1=`grep ^DNS1= $CONF_FILE | cut -d'=' -f2`                   # server DNS1 (for WL domain names)
39
DOMAIN=${DOMAIN:=localdomain}
36
DOMAIN=${DOMAIN:=localdomain}
40
DATE=`date '+%d %B %Y - %Hh%M'`
37
DATE=`date '+%d %B %Y - %Hh%M'`
41
 
38
 
Line 71... Line 68...
71
                ;;
68
                ;;
72
        --create|-create)      
69
        --create|-create)      
73
                [ -d $DIR_UPDATE ] && rm -rf $DIR_UPDATE
70
                [ -d $DIR_UPDATE ] && rm -rf $DIR_UPDATE
74
                mkdir $DIR_UPDATE
71
                mkdir $DIR_UPDATE
75
# backup the users database  (test to delete in future version)
72
# backup the users database  (test to delete in future version)
76
                if [ -e $DIR_BIN/alcasar-mysql.sh ]; then
-
 
77
                        $DIR_BIN/alcasar-mysql.sh --dump
73
                $DIR_BIN/alcasar-mysql.sh --dump
78
                else
-
 
79
                        /usr/local/sbin/alcasar-mysql.sh --dump
-
 
80
                fi
-
 
81
                cp /var/Save/base/`ls -1t /var/Save/base|head -1` $DIR_UPDATE
74
                cp /var/Save/base/`ls -1t /var/Save/base|head -1` $DIR_UPDATE
82
# backup the logo
75
# backup the logo
83
                cp -f $DIR_WEB/images/organisme.png $DIR_UPDATE
76
                cp -f $DIR_WEB/images/organisme.png $DIR_UPDATE
84
# backup BL/WL custom files
77
# backup BL/WL custom files
85
                mkdir $DIR_UPDATE/custom_bl
78
                mkdir $DIR_UPDATE/custom_bl
Line 150... Line 143...
150
        # add "SMS=off" in conf file
143
        # add "SMS=off" in conf file
151
                        if [ $(grep -c '^SMS=' $DIR_UPDATE/etc/alcasar.conf) -eq 0 ]; then
144
                        if [ $(grep -c '^SMS=' $DIR_UPDATE/etc/alcasar.conf) -eq 0 ]; then
152
                                        echo "SMS=off" >> $DIR_UPDATE/etc/alcasar.conf
145
                                        echo "SMS=off" >> $DIR_UPDATE/etc/alcasar.conf
153
                        fi
146
                        fi
154
                        if [ $(grep -c '^SMS_NUM=' $DIR_UPDATE/etc/alcasar.conf) -eq 0 ]; then
147
                        if [ $(grep -c '^SMS_NUM=' $DIR_UPDATE/etc/alcasar.conf) -eq 0 ]; then
155
                                        echo "SMS_NUM=0" >> $DIR_UPDATE/etc/alcasar.conf
148
                                        echo "SMS_NUM=" >> $DIR_UPDATE/etc/alcasar.conf
156
                        fi
149
                        fi
157
                fi
150
                fi
158
######################   End of modifications between versions  #######################
151
######################   End of modifications between versions  #######################
159
# Retrieve the logo
152
# Retrieve the logo
160
                [ -e $DIR_UPDATE/organisme.png ] && cp -f $DIR_UPDATE/organisme.png $DIR_WEB/images/
153
                [ -e $DIR_UPDATE/organisme.png ] && cp -f $DIR_UPDATE/organisme.png $DIR_WEB/images/
Line 167... Line 160...
167
                cp -f $DIR_UPDATE/alcasar.pem /etc/pki/tls/private/    
160
                cp -f $DIR_UPDATE/alcasar.pem /etc/pki/tls/private/    
168
                [ -e $DIR_UPDATE/server-chain.crt ] && cp -f $DIR_UPDATE/server-chain.crt* /etc/pki/tls/certs/ # autosigned and official if exist
161
                [ -e $DIR_UPDATE/server-chain.crt ] && cp -f $DIR_UPDATE/server-chain.crt* /etc/pki/tls/certs/ # autosigned and official if exist
169
                chown -R root:apache /etc/pki
162
                chown -R root:apache /etc/pki
170
                chmod -R 750 /etc/pki
163
                chmod -R 750 /etc/pki
171
# Import of the users database
164
# Import of the users database
172
                gzip -dc < `ls $DIR_UPDATE/alcasar-users-database*` | mysql -u$DB_USER -p$DB_PASS
165
                $DIR_BIN/alcasar-mysql.sh --import `ls $DIR_UPDATE/alcasar-users-database*`
173
# Retrieve local parameters
166
# Retrieve local parameters
174
                cp -rf $DIR_UPDATE/etc/* $DIR_ETC/
167
                cp -rf $DIR_UPDATE/etc/* $DIR_ETC/
175
                mv -f $DIR_UPDATE/etc/hosts /etc/hosts
168
                mv -f $DIR_UPDATE/etc/hosts /etc/hosts
176
                chmod 755 /etc/hosts
169
                chmod 755 /etc/hosts
177
# Retrieve BL/WL custom files
170
# Retrieve BL/WL custom files