shell脚本配置apt源
#!/bin/bash #MODIFY: if [ `whoami` != "root" ];then echo "This script must be runing as root!!!" exit 71 fi export LC_ALL=en_US.UTF-8 current_dir=$(cd `dirname $0` && pwd) #当前工作目录 cecho(){ echo -e "\033[$1m$2\033[0m" } #配置本地apt源 Conf_Apt(){ [ ! -f ${current_dir}/archives/Packages.gz ] && cecho 31 "${current_dir}没有有效源" && exit 71 [ ! -f /etc/apt/sources.list.save ] && cp /etc/apt/sources.list{,.bak} tee /etc/apt/sources.list << EOF deb file:${current_dir} archives/ EOF apt-get update --allow-insecure-repositories &>/dev/null apt-get install -f &>/dev/null } #配置ubuntu14.04网络源 Conf_Ubuntu14.04(){