更新源

master
yutent 2023-10-07 17:49:44 +08:00
parent 5128cfbcd9
commit b556390f51
6 changed files with 26 additions and 14 deletions

View File

@ -1,5 +1,17 @@
#!/bin/bash
codename=$(lsb_release -cs)
archname=$(arch)
if [ "$codename" == "" ]; then
codename=bookworm
fi
if [ "$archname" == "x86_64" ]; then
archname=amd64
else
archname=arm64
fi
function print_help () {
@ -26,7 +38,7 @@ function add_repo () {
case $1 in
chrome)
echo '正在添加chrome源...'
sudo cp /usr/lib/extra-repo-book/sources.list.d/chrome.list /etc/apt/sources.list.d/
echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/chrome.list > /dev/null
sudo cp /usr/lib/extra-repo-book/trusted.gpg.d/google.gpg /etc/apt/trusted.gpg.d/
read -p "添加完成, 是否更新索引? y/n: " action
if [[ "$action" == "" || "$action" == "y" ]]; then
@ -35,7 +47,7 @@ function add_repo () {
;;
edge)
echo '正在添加edge源...'
sudo cp /usr/lib/extra-repo-book/sources.list.d/edge.list /etc/apt/sources.list.d/
echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge/ stable main" | sudo tee /etc/apt/sources.list.d/edge.list > /dev/null
sudo cp /usr/lib/extra-repo-book/trusted.gpg.d/microsoft.gpg /etc/apt/trusted.gpg.d/
read -p "添加完成, 是否更新索引? y/n: " action
if [[ "$action" == "" || "$action" == "y" ]]; then
@ -44,7 +56,7 @@ function add_repo () {
;;
vscode)
echo '正在添加vscode源...'
sudo cp /usr/lib/extra-repo-book/sources.list.d/vscode.list /etc/apt/sources.list.d/
echo "deb [arch=amd64] http://packages.microsoft.com/repos/code stable main" | sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null
sudo cp /usr/lib/extra-repo-book/trusted.gpg.d/microsoft.gpg /etc/apt/trusted.gpg.d/
read -p "添加完成, 是否更新索引? y/n: " action
if [[ "$action" == "" || "$action" == "y" ]]; then
@ -52,9 +64,17 @@ function add_repo () {
fi
;;
mysql8)
if [ "$codename" == "bookworm" ]; then
echo "mysql8 暂时不支持debian bookworm..."
echo "有有需要, 请改用docker安装"
exit 0
fi
echo '正在添加mysql8源...'
sudo cp /usr/lib/extra-repo-book/sources.list.d/mysql.list /etc/apt/sources.list.d/
echo "deb [arch=amd64] http://repo.mysql.com/apt/debian/ ${codename} mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql.list > /dev/null
echo "deb [arch=amd64] http://repo.mysql.com/apt/debian/ ${codename} mysql-tools" | sudo tee -a /etc/apt/sources.list.d/mysql.list > /dev/null
sudo cp /usr/lib/extra-repo-book/trusted.gpg.d/mysql.gpg /etc/apt/trusted.gpg.d/
read -p "添加完成, 是否更新索引? y/n: " action
if [[ "$action" == "" || "$action" == "y" ]]; then
sudo apt update
@ -62,7 +82,8 @@ function add_repo () {
;;
docker)
echo '正在添加docker源...'
sudo cp /usr/lib/extra-repo-book/sources.list.d/docker.list /etc/apt/sources.list.d/
echo "deb [arch=${archname}] https://download.docker.com/linux/debian ${codename} stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo cp /usr/lib/extra-repo-book/trusted.gpg.d/docker.gpg /etc/apt/trusted.gpg.d/
read -p "添加完成, 是否更新索引? y/n: " action
if [[ "$action" == "" || "$action" == "y" ]]; then

View File

@ -1 +0,0 @@
deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main

View File

@ -1 +0,0 @@
deb [arch=amd64] https://download.docker.com/linux/debian bullseye stable

View File

@ -1,2 +0,0 @@
deb [arch=amd64] https://packages.microsoft.com/repos/edge/ stable main

View File

@ -1,3 +0,0 @@
deb http://repo.mysql.com/apt/debian/ bullseye mysql-8.0
deb http://repo.mysql.com/apt/debian/ bullseye mysql-tools

View File

@ -1,2 +0,0 @@
deb [arch=amd64] http://packages.microsoft.com/repos/code stable main