From b556390f5138173a108b3fb86730c5f9b7a80d15 Mon Sep 17 00:00:00 2001 From: yutent Date: Sat, 7 Oct 2023 17:49:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr/bin/repo-book | 31 ++++++++++++++++--- .../sources.list.d/chrome.list | 1 - .../sources.list.d/docker.list | 1 - .../extra-repo-book/sources.list.d/edge.list | 2 -- .../extra-repo-book/sources.list.d/mysql.list | 3 -- .../sources.list.d/vscode.list | 2 -- 6 files changed, 26 insertions(+), 14 deletions(-) delete mode 100644 usr/lib/extra-repo-book/sources.list.d/chrome.list delete mode 100644 usr/lib/extra-repo-book/sources.list.d/docker.list delete mode 100644 usr/lib/extra-repo-book/sources.list.d/edge.list delete mode 100644 usr/lib/extra-repo-book/sources.list.d/mysql.list delete mode 100644 usr/lib/extra-repo-book/sources.list.d/vscode.list diff --git a/usr/bin/repo-book b/usr/bin/repo-book index 6004ad1..bf9818d 100755 --- a/usr/bin/repo-book +++ b/usr/bin/repo-book @@ -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 diff --git a/usr/lib/extra-repo-book/sources.list.d/chrome.list b/usr/lib/extra-repo-book/sources.list.d/chrome.list deleted file mode 100644 index c13fe7b..0000000 --- a/usr/lib/extra-repo-book/sources.list.d/chrome.list +++ /dev/null @@ -1 +0,0 @@ -deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main diff --git a/usr/lib/extra-repo-book/sources.list.d/docker.list b/usr/lib/extra-repo-book/sources.list.d/docker.list deleted file mode 100644 index 75d1264..0000000 --- a/usr/lib/extra-repo-book/sources.list.d/docker.list +++ /dev/null @@ -1 +0,0 @@ -deb [arch=amd64] https://download.docker.com/linux/debian bullseye stable diff --git a/usr/lib/extra-repo-book/sources.list.d/edge.list b/usr/lib/extra-repo-book/sources.list.d/edge.list deleted file mode 100644 index 7d58dfe..0000000 --- a/usr/lib/extra-repo-book/sources.list.d/edge.list +++ /dev/null @@ -1,2 +0,0 @@ - -deb [arch=amd64] https://packages.microsoft.com/repos/edge/ stable main diff --git a/usr/lib/extra-repo-book/sources.list.d/mysql.list b/usr/lib/extra-repo-book/sources.list.d/mysql.list deleted file mode 100644 index 52517ee..0000000 --- a/usr/lib/extra-repo-book/sources.list.d/mysql.list +++ /dev/null @@ -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 diff --git a/usr/lib/extra-repo-book/sources.list.d/vscode.list b/usr/lib/extra-repo-book/sources.list.d/vscode.list deleted file mode 100644 index 49a8669..0000000 --- a/usr/lib/extra-repo-book/sources.list.d/vscode.list +++ /dev/null @@ -1,2 +0,0 @@ - -deb [arch=amd64] http://packages.microsoft.com/repos/code stable main