| 61,7 → 61,10 |
| echo "$usage" |
| exit 0 |
| ;; |
| --create|-create) |
| ################################################### |
| ## Create an archive conf file ## |
| ################################################### |
| --create|-create) |
| [ -d $DIR_UPDATE ] && rm -rf $DIR_UPDATE |
| mkdir $DIR_UPDATE |
| # backup the users database (test to delete in future version) |
| 105,6 → 108,9 |
| rm -rf $DIR_UPDATE |
| ;; |
| |
| ################################################### |
| ## Load an archive conf file ## |
| ################################################### |
| --load|-load) |
| cd /var/tmp || { echo "Unable to find /var/tmp directory"; } |
| tar -xf alcasar-conf.tar.gz |
| 123,7 → 129,7 |
| sed -i "s?^$key.*?$key$value?g" /usr/local/etc/alcasar.conf |
| fi |
| done |
| ## lighttpd need a .pem certificate (aggregation with private key & server crt) |
| # lighttpd need a .pem certificate (aggregation with private key & server crt) |
| [ ! -f $DIR_UPDATE/alcasar.pem ] && (cat $DIR_UPDATE/alcasar.key; echo; cat $DIR_UPDATE/alcasar.crt) > $DIR_UPDATE/alcasar.pem |
| # Retrieve organism logo |
| [ -e $DIR_UPDATE/organisme.png ] && cp -f $DIR_UPDATE/organisme.png $DIR_WEB/images/ |
| 154,6 → 160,8 |
| [ -e $DIR_UPDATE/etc/alcasar-ethers ] && cp -f $DIR_UPDATE/etc/alcasar-ethers $DIR_ETC/ # DHCP static hosts |
| [ -e $DIR_UPDATE/etc/alcasar-ethers-info ] && cp -f $DIR_UPDATE/etc/alcasar-ethers-info $DIR_ETC/ # DHCP static hosts information |
| [ -e $DIR_UPDATE/etc/hosts ] && cp -f $DIR_UPDATE/etc/hosts /etc/ # local host name resolution |
| [ -e $DIR_UPDATE/etc/alcasar-letsencrypt ] && cp -f $DIR_UPDATE/etc/alcasar-letsencrypt $DIR_ETC/ # Letsencrypt local conf |
| [ -d $DIR_UPDATE/etc/letsencrypt ] && cp -rf $DIR_UPDATE/etc/letsencrypt $DIR_ETC/ # Letsencrypt local conf files |
| # Retrieve BL/WL custom files |
| cp -f $DIR_UPDATE/custom_bl/exceptioniplist $DIR_E2G/ |
| cp -f $DIR_UPDATE/custom_bl/exceptionsitelist $DIR_E2G/ |
| 183,6 → 191,9 |
| rm -rf $DIR_UPDATE |
| ;; |
| |
| #################################################### |
| ## Configure ALCASAR according to alcasar.conf ## |
| #################################################### |
| --apply|-apply) |
| PTN="\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/([012]?[0-9]|3[0-2])\b" |
| PRIVATE_IP_MASK=`grep ^PRIVATE_IP= $CONF_FILE|cut -d"=" -f2` |