#!/bin/bash
ubuntu_16_04=`cat /etc/issue | grep 16.04`

rm -f /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo Asia/Shanghai > /etc/timezone
echo "update timezone Asia/Shanghai"


echo "deb http://mirrors.idste.org/ubuntu/ idste main" > /etc/apt/sources.list.d/idste.list
if [[ "$ubuntu_16_04" != "" ]]; then
    wget -O - http://mirrors.idste.org/ubuntu.key | sudo apt-key add -
    echo "system os is ubunt16.04"
else
    wget -O - http://mirrors.idste.org/ubuntu.key | sudo gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/idste.gpg --import
    sudo chown _apt /etc/apt/trusted.gpg.d/idste.gpg
    echo "system os is not ubuntu16.04"
fi

apt update

apt-get install ntp ntpstat ntpdate net-tools -y
apt-get install supervisor -y
apt-get install unzip -y

# mysql 8 会报错，这一行不执行
#apt-get remove unattended-upgrades
systemctl stop apt-daily.timer
systemctl disable apt-daily.timer
systemctl stop apt-daily.service
systemctl disable apt-daily.service
systemctl daemon-reload
systemctl mask apt-daily.service

count=`systemctl status apt-daily-upgrade.timer | grep "Active: active" | wc -l`
if [[ $count >0 ]]
then
        echo "disable apt-daily-upgrade.timer now"
        systemctl stop apt-daily-upgrade.timer
        systemctl disable apt-daily-upgrade.timer
        echo "disable apt-daily-upgrade.service now"
        systemctl stop apt-daily-upgrade.service
        systemctl disable apt-daily-upgrade.service
        systemctl mask apt-daily-upgrade.service
fi





