Newer
Older
#!/bin/bash
source /root/envsetup/envsetup.conf
echo -e "
${RED}Customer parameters will be applied after rebooting. Note that you won't be able to login to the machine after this operation !${NC}"
# set customer IP (/etc/network/interfaces)
sed -i "s@192\.168\.40\.10.*@${NETWORK_IP}@" /etc/network/interfaces
sed -i "s@255\.255\.252\..*@${NETWORK_MASK}@" /etc/network/interfaces
sed -i "s@192\.168\.40\..*@${NETWORK_GATEWAY}@" /etc/network/interfaces
# backup-server specific
if ( test -f /usr/sbin/burp )
then
# changer burp status IP
sed -i "s@^BURP_CLIENT_MAIL_DEST=.*@BURP_CLIENT_MAIL_DEST=${BURP_CLIENT_MAIL_DEST}@" /root/burp-custom.sh
sed -i "s@admin: .*@admin: ${BURP_CLIENT_MAIL_DEST}" /etc/aliases
echo "nameserver ${NETWORK_DNS1}" > /etc/resolv.conf
echo "nameserver ${NETWORK_DNS2}" >> /etc/resolv.conf
# set customer NTP
sed -i "s@^server .*@@" /etc/ntp.conf
echo "" >> /etc/ntp.conf
echo "server ${NTP_SERVER1}" >> /etc/ntp.conf
if ( ! test -z ${NTP_SERVER2} )
echo "server ${NTP_SERVER2}" >> /etc/ntp.conf
if ( ! test -z ${NTP_SERVER3} )
echo "server ${NTP_SERVER3}" >> /etc/ntp.conf
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
fi
service ntp restart
# proxy
if [ ${PROXY} = "1" ]
then
if [ ${PROXY_AUTHENTICATION} = "1" ]
then
# APT
echo "Acquire::http::Proxy \"http://${PROXY_USER}:${PROXY_PASSWD}@${PROXY_HTTP}:${PROXY_PORT}\";" > /etc/apt/apt.conf.d/proxy
echo "Acquire::https::Proxy \"http://${PROXY_USER}:${PROXY_PASSWD}@${PROXY_HTTP}:${PROXY_PORT}\";" >> /etc/apt/apt.conf.d/proxy
# /etc/environment
echo "http_proxy=\"http://${PROXY_USER}:${PROXY_PASSWD}@${PROXY_HTTP}:${PROXY_PORT}\"" >> /etc/environment
echo "https_proxy=\"http://${PROXY_USER}:${PROXY_PASSWD}@${PROXY_HTTP}:${PROXY_PORT}\"" >> /etc/environment
else
# APT
echo "Acquire::http::Proxy \"http://${PROXY_HTTP}:${PROXY_PORT}\";" > /etc/apt/apt.conf.d/proxy
echo "Acquire::https::Proxy \"http://${PROXY_HTTP}:${PROXY_PORT}\";" >> /etc/apt/apt.conf.d/proxy
# /etc/environment
echo "http_proxy=\"http://${PROXY_HTTP}:${PROXY_PORT}\"" >> /etc/environment
echo "https_proxy=\"http://${PROXY_HTTP}:${PROXY_PORT}\"" >> /etc/environment
fi
fi
# MS specific
if ( test -d /usr/local/WowzaStreamingEngine )
then
if [ ${PROXY} = "1" ]
then
# wowza
NB=$(grep -n 'Properties defined here will be added to the IServer.getProperties()' /usr/local/WowzaStreamingEngine/conf/Server.xml | awk -F ":" '{print$1}')
NB_1=$(( ${NB} + 1 ))
NB_MAX=$(wc -l /usr/local/WowzaStreamingEngine/conf/Server.xml | awk '{print$1}')
if [ ${PROXY_AUTHENTICATION} = "1" ]
then
sed -i "${NB_1},${NB_MAX}d" /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Properties>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Name>licenseServerProxyAddress</Name>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Value>${PROXY_HTTP}</Value>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "</Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Name>licenseServerProxyPort</Name>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Value>${PROXY_PORT}</Value>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Type>Integer</Type>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "</Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Name>licenseServerProxyUsername</Name>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Value>${PROXY_USER}</Value>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "</Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Name>licenseServerProxyPassword</Name>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Value>${PROXY_PASSWD}</Value>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "</Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "</Properties>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "</Server>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "</Root> " >> /usr/local/WowzaStreamingEngine/conf/Server.xml
else
sed -i "${NB_1},${NB_MAX}d" /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Properties>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Name>licenseServerProxyAddress</Name>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Value>${PROXY_HTTP}</Value>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "</Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Name>licenseServerProxyPort</Name>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Value>${PROXY_PORT}</Value>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "<Type>Integer</Type>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "</Property>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "</Properties>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "</Server>" >> /usr/local/WowzaStreamingEngine/conf/Server.xml
echo "</Root> " >> /usr/local/WowzaStreamingEngine/conf/Server.xml
fi
fi
fi
# set email sender
if ( ! test -z ${EMAIL_SENDER} )
echo "#DEFAULT_FROM_EMAIL = '${EMAIL_SENDER}'" >> /etc/mediaserver/msconf.py
echo "#DEFAULT_FROM_EMAIL = '${EMAIL_SENDER}'" >> /home/skyreach/htdocs/skyreach_site/settings_override.py
fi
# set locale
echo -e "${CYAN}You will now change the locales.${NC}"
locale-gen en_GB.UTF-8
dpkg-reconfigure locales
update-locale LANG=en_GB.UTF-8 LANGUAGE=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
#dpkg-reconfigure console-data
#dpkg-reconfigure keyboard-configuration
# set TZ
echo -e "${CYAN}You will now change the time zone.${NC}"
dpkg-reconfigure tzdata