view scripts/dns_srv/configure_dns_srv.sh @ 105:b69056368901

docker: images optimisation: - reduced the number of layers by grouping many instructions - moved stuff which don't change a lot at the beginning, and hg/apt at the end - scripts are not now in scripts/ subdirectories - prosody.cfg.lua is added using ADD instead of getting it online - .hg/dirstate is copied in base (backend) and libervia, so mercurial revision is known - removed lot of useless WORKDIR instruction, they are replaced by "cd" inside RUN instructions - cleaning (apt-clean, rm) is done on the same instruction as the one than generate the data, to avoid useless data in layers
author Goffi <goffi@goffi.org>
date Sun, 28 Feb 2016 02:01:20 +0100
parents 358a4fc0e091
children
line wrap: on
line source

#!/bin/bash

# This script allows you to quickly change your bind9 configuration:
#     - define an internal domain and bind it to 127.0.0.1
#     - add SRV records to use this domain with your local XMPP server
#
# It will mess up your actual bind9 configuration. It should not be used on
# production servers but only on your development machine with local servers.
# USE AT YOUR OWN RISK! Be sure to BACKUP /etc/bind and /var/cache/bind before!
#
# Configuration files based on:
#     - http://www.madboa.com/geek/soho-bind
#     - http://wiki.xmpp.org/web/SRV_Records
#     - http://prosody.im/doc/dns
#
# For this to work, Prosody configuration must define the domain as a VirtualHost.
# It is also assumed that the Prosody "directory" option is set to "/var/cache/bind".
#
# Finally, you may want to modify your SàT configuration file to set the option
# "new_account_domain" to that domain passed in $1 in order to register new
# account from Libervia, and the "jid" option of sat_pubsub should be set to
# "sat-pubsub.<domain>" for the (micro)blogging feature to work.
#
# You can also check this page with additional information about how to restore
# your previously configured domains (if any...) after having ran the script:
# http://wiki.goffi.org/wiki/How_to_change_your_Libervia%27s_domain_name/en

if [ $# -lt 2 ]; then
  echo "Usage: `basename $0` <domain> <c2s_port>"
  exit 1
fi

HOSTNAME=`cat /etc/hostname`
DOMAIN=$1
C2S_PORT=$2
DATE=`date +%s`

mkdir -p /tmp/$DATE/
cp -r template/* /tmp/$DATE/
cd /tmp/$DATE
for FILE in `find . -type f`; do
    sed -e s/\<domain\>/$DOMAIN/g -e s/\<hostname\>/$HOSTNAME/g -e s/\<date\>/$DATE/g -e s/\<c2s_port\>/$C2S_PORT/g $FILE > `echo $FILE | sed -e 's/^.//' -e s/my.domain/$DOMAIN/`
done
/etc/init.d/bind9 restart
tail /var/log/syslog