LegacyTechops/slack/prod/tsys-base/scripts/postinstall

76 lines
2.0 KiB
Plaintext
Raw Normal View History

2018-02-02 04:14:37 +00:00
#!/bin/bash
2018-02-09 03:04:36 +00:00
ISUCS="$(hostname |grep ucs -c)"
if [ $ISUCS -ne 0 ]; then
echo "Do not run this on ucs host. Exiting..."
exit 1
fi
2019-04-21 16:14:47 +00:00
########################################
#Common to all systems
########################################
#Fix timezone
unlink /etc/localtime
ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
2019-02-25 03:07:14 +00:00
MGMT_INT=$(netstat -rn|grep 0.0.0.0|head -n1|awk '{print $NF}')
PFV_MGMT_IP=$(ifconfig $MGMT_INT|grep inet|grep 10.251 -c)
OVH_MGMT_IP=$(ifconfig $MGMT_INT|grep inet|grep 10.253 -c)
if [ $PFV_MGMT_IP -eq 1 ]; then
tsysSysLocation=pfv
fi
if [ $OVH_MGMT_IP -eq 1 ]; then
tsysSysLocation=ovh
fi
2019-04-21 16:16:57 +00:00
#/usr/local/bin/up2date.sh
2019-04-21 17:09:51 +00:00
2019-04-21 16:16:57 +00:00
#apt-get update
#apt-get -y --purge autoremove
#apt-get -y autoclean
#apt-get -y upgrade
#apt-get -y dist-upgrade
2019-02-25 01:46:07 +00:00
2019-04-21 17:09:51 +00:00
#Step 1: Update the cache and apply all vendor patches
echo "Running apt-get update"
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes update
echo "Running apt-get dist-upgrade"
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes dist-upgrade
echo "Running apt-get upgrade"
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes upgrade
echo "Running apt-get purge"
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --purge autoremove --yes
#Step 2: Cleanup default cruft
echo "removing evil from the world, one nano install at a time"
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes --purge remove nano
if [ $UBUNTU_SERVER -eq 0 ]; then
sed -i "s/dns=dnsmasq/#dns=dnsmasq/" /etc/NetworkManager/NetworkManager.conf
fi
unlink /etc/resolv.conf
ln -s /etc/tplab-resolv.conf /etc/resolv.conf
#Step 3: The usual suspects
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes -o Dpkg::Options::="--force-confold" install snmpd sssd sssd-ad ncdu iftop nethogs screen open-vm-tools acct tshark tcpdump glances dstat htop sysdig sysstat rsync clamav logwatch zsh sl postfix molly-guard git mailutils ladvd etckeeper auditd rkhunter rsyslog ngrep ntp
#Turn on process accounting
echo "Turning on process accounting..."
accton on
2019-02-25 03:07:14 +00:00
slack tsys-$tsysSysLocation