From 30e2fb42fd1d204f67c4f2f0aae950755c4149f9 Mon Sep 17 00:00:00 2001 From: MeGuMinEx <46551531+NicoNekoMIAO@users.noreply.github.com> Date: Mon, 7 Jun 2021 09:53:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8D=95=E7=9A=84=E6=8D=A2=E6=BA=90sh?= =?UTF-8?q?ell=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 仅支持Debian,第一版仅支持更换中科大源。 --- shell.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 shell.sh diff --git a/shell.sh b/shell.sh new file mode 100644 index 0000000..4f5dc9e --- /dev/null +++ b/shell.sh @@ -0,0 +1,35 @@ +#sudo apt-get update +echo "仅支持Debian 10,9,8,7" +result=`lsb_release -a` + +target="/etc/apt/sources.list" +echo ====================================== +mv /etc/apt/sources.list /etc/apt/sourcesbackup.list +echo "原sources.list文件已在/etc/apt路径下备份为sourcesbackup.list" +echo ====================================== +echo $result +echo ====================================== +codename=${result##*:} +#截取result变量获取到的内容,从右向左第一个 : 开始左边全部删除并存入codename变量 +echo codename +echo $codename +echo ====================================== +echo result +echo ${result##*:} +echo ====================================== + echo "写入中" + echo ====================================== + echo "deb http://mirrors.ustc.edu.cn/debian/ "${codename}" main non-free contrib" > $target + echo "deb http://mirrors.ustc.edu.cn/debian/ "${codename}"-proposed-updates main non-free contrib" >> $target + echo "deb-src http://mirrors.ustc.edu.cn/debian/" ${codename} "main non-free contrib">> $target + echo "deb-src http://mirrors.ustc.edu.cn/debian/" ${codename}"-proposed-updates main non-free contrib" >>$target + echo "写入完成" + echo ====================================== +echo "更新软件源" +sudo apt-get update +#更新apt软件源 +echo ====================================== +echo "升级" +sudo apt-get upgrade +echo ====================================== +#执行一次升级