Skip to content
Snippets Groups Projects
0_setup.sh 1.76 KiB
#!/bin/bash
source /root/envsetup/global-conf.sh

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
newaliases
fi

# set customer DNS
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} )
then
echo "server ${NTP_SERVER2}" >> /etc/ntp.conf
fi

if ( ! test -z ${NTP_SERVER3} )
then
echo "server ${NTP_SERVER3}" >> /etc/ntp.conf
fi
service ntp restart

# set email sender
if ( ! test -z ${EMAIL_SENDER} )
then
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