#!/bin/bash type=$(cat /etc/*release | grep ^ID= | cut -d= -f2) release=$(cat /etc/*release | grep VERSION_CODENAME | cut -d= -f2) components=$([ "${type}" = "debian" ] && echo "main contrib non-free non-free-firmware" || ([ "${type}" = "ubuntu" ] && echo "main restricted universe multiverse")) # DEB822 格式 # docker.martin98.com/library/ubuntu:latest # docker.martin98.com/library/debian:latest if [ -f /etc/apt/sources.list.d/${type}.sources ]; then cat > /etc/apt/sources.list.d/${type}.sources < /etc/apt/sources.list < /etc/chrony.conf </dev/null 2>&1; then systemctl restart chrony && systemctl enable chrony else echo "systemctl 不存在,跳过 chrony 的重启" fi # fix vim 粘贴 if ! grep -q "set pastetoggle=" ~/.vimrc; then echo "set pastetoggle=" >> ~/.vimrc fi