From 2a0a7a71e350f136bcf2fb6e76597f066cc4fec5 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Mon, 24 Jun 2024 15:39:45 +0000 Subject: [PATCH 1/3] update apt sources --- .../localize/run-config-mirror-aliyun-pub.sh | 7 ++++--- .../localize/run-config-mirror-aliyun-vpc.sh | 7 ++++--- .../localize/run-config-mirror-tencent-pub.sh | 7 ++++--- .../localize/run-config-mirror-tencent-vpc.sh | 7 ++++--- .../work/localize/run-config-mirror-tsinghua.sh | 7 ++++--- docker_atom/work/script-localize.sh | 2 ++ docker_atom/work/script-setup-db-clients.sh | 16 ++++++---------- 7 files changed, 28 insertions(+), 25 deletions(-) diff --git a/docker_atom/work/localize/run-config-mirror-aliyun-pub.sh b/docker_atom/work/localize/run-config-mirror-aliyun-pub.sh index 36b250b..b0ad5df 100644 --- a/docker_atom/work/localize/run-config-mirror-aliyun-pub.sh +++ b/docker_atom/work/localize/run-config-mirror-aliyun-pub.sh @@ -7,14 +7,15 @@ export TZ=${TZ:="Asia/Shanghai"} ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone echo "Setup timezone, current date: $(date)" -if [ -f /etc/apt/sources.list ]; then - echo "Found Ubuntu/debian system, setting ubuntu/debian mirror" +eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}" +if [ -f /etc/apt/sources.list ]; then + [ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && ln -sf /etc/apt/sources.list.d/${OS_ID}.sources /etc/apt/sources.list sed -i 's/mirrors.*.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' /etc/apt/sources.list sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' /etc/apt/sources.list sed -i 's/security.ubuntu.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/deb.debian.org\/debian/mirrors.aliyun.com\/debian/' /etc/apt/sources.list + echo "Finished setting ubuntu/debian mirror" fi if [ -f "$(which python)" ]; then diff --git a/docker_atom/work/localize/run-config-mirror-aliyun-vpc.sh b/docker_atom/work/localize/run-config-mirror-aliyun-vpc.sh index 729bcac..8f9197b 100644 --- a/docker_atom/work/localize/run-config-mirror-aliyun-vpc.sh +++ b/docker_atom/work/localize/run-config-mirror-aliyun-vpc.sh @@ -7,14 +7,15 @@ export TZ=${TZ:="Asia/Shanghai"} ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone echo "Setup timezone, current date: $(date)" -if [ -f /etc/apt/sources.list ]; then - echo "Found Ubuntu/debian system, setting ubuntu/debian mirror" +eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}" +if [ -f /etc/apt/sources.list ]; then + [ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && ln -sf /etc/apt/sources.list.d/${OS_ID}.sources /etc/apt/sources.list sed -i 's/mirrors.*.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' /etc/apt/sources.list sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' /etc/apt/sources.list sed -i 's/security.ubuntu.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/deb.debian.org\/debian/mirrors.cloud.aliyuncs.com\/debian/' /etc/apt/sources.list + echo "Finished setting ubuntu/debian mirror" fi if [ -f "$(which python)" ]; then diff --git a/docker_atom/work/localize/run-config-mirror-tencent-pub.sh b/docker_atom/work/localize/run-config-mirror-tencent-pub.sh index 3f3581b..54a4906 100644 --- a/docker_atom/work/localize/run-config-mirror-tencent-pub.sh +++ b/docker_atom/work/localize/run-config-mirror-tencent-pub.sh @@ -7,14 +7,15 @@ export TZ=${TZ:="Asia/Shanghai"} ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone echo "Setup timezone, current date: $(date)" -if [ -f /etc/apt/sources.list ]; then - echo "Found Ubuntu/debian system, setting ubuntu/debian mirror" +eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}" +if [ -f /etc/apt/sources.list ]; then + [ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && ln -sf /etc/apt/sources.list.d/${OS_ID}.sources /etc/apt/sources.list sed -i 's/mirrors.*.com\/ubuntu/mirrors.tencent.com\/ubuntu/' /etc/apt/sources.list sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tencent.com\/ubuntu/' /etc/apt/sources.list sed -i 's/security.ubuntu.com\/ubuntu/mirrors.tencent.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/deb.debian.org\/debian/mirrors.tencent.com\/debian/' /etc/apt/sources.list + echo "Finished setting ubuntu/debian mirror" fi if [ -f "$(which python)" ]; then diff --git a/docker_atom/work/localize/run-config-mirror-tencent-vpc.sh b/docker_atom/work/localize/run-config-mirror-tencent-vpc.sh index 86cec7d..a237b2a 100644 --- a/docker_atom/work/localize/run-config-mirror-tencent-vpc.sh +++ b/docker_atom/work/localize/run-config-mirror-tencent-vpc.sh @@ -7,14 +7,15 @@ export TZ=${TZ:="Asia/Shanghai"} ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone echo "Setup timezone, current date: $(date)" -if [ -f /etc/apt/sources.list ]; then - echo "Found Ubuntu/debian system, setting ubuntu/debian mirror" +eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}" +if [ -f /etc/apt/sources.list ]; then + [ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && ln -sf /etc/apt/sources.list.d/${OS_ID}.sources /etc/apt/sources.list sed -i 's/mirrors.*.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' /etc/apt/sources.list sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' /etc/apt/sources.list sed -i 's/security.ubuntu.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/deb.debian.org\/debian/mirrors.tencentyun.com\/debian/' /etc/apt/sources.list + echo "Finished setting ubuntu/debian mirror" fi if [ -f "$(which python)" ]; then diff --git a/docker_atom/work/localize/run-config-mirror-tsinghua.sh b/docker_atom/work/localize/run-config-mirror-tsinghua.sh index 3f5dfe2..41899dd 100644 --- a/docker_atom/work/localize/run-config-mirror-tsinghua.sh +++ b/docker_atom/work/localize/run-config-mirror-tsinghua.sh @@ -7,14 +7,15 @@ export TZ=${TZ:="Asia/Shanghai"} ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone echo "Setup timezone, current date: $(date)" -if [ -f /etc/apt/sources.list ]; then - echo "Found Ubuntu/debian system, setting ubuntu/debian mirror" +eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}" +if [ -f /etc/apt/sources.list ]; then + [ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && ln -sf /etc/apt/sources.list.d/${OS_ID}.sources /etc/apt/sources.list sed -i 's/mirrors.*.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' /etc/apt/sources.list sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' /etc/apt/sources.list sed -i 's/security.ubuntu.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' /etc/apt/sources.list - sed -i 's/deb.debian.org\/debian/mirrors.tuna.tsinghua.edu.cn\/debian/' /etc/apt/sources.list + echo "Finished setting ubuntu/debian mirror" fi if [ -f "$(which python)" ]; then diff --git a/docker_atom/work/script-localize.sh b/docker_atom/work/script-localize.sh index f30543f..631f910 100644 --- a/docker_atom/work/script-localize.sh +++ b/docker_atom/work/script-localize.sh @@ -2,3 +2,5 @@ PROFILE_LOCALIZE=${PROFILE_LOCALIZE:-"default"} echo "Using PROFILE_LOCALIZE=${PROFILE_LOCALIZE}" source /opt/utils/localize/run-config-mirror-${PROFILE_LOCALIZE}.sh + +# reference: https://github.com/RubyMetric/chsrc/blob/main/src/chsrc.c diff --git a/docker_atom/work/script-setup-db-clients.sh b/docker_atom/work/script-setup-db-clients.sh index 3477dce..b95358d 100644 --- a/docker_atom/work/script-setup-db-clients.sh +++ b/docker_atom/work/script-setup-db-clients.sh @@ -4,30 +4,27 @@ source /opt/utils/script-utils.sh setup_postgresql_client() { local VER_PG=${PG_MAJOR:-"15"} # from: https://www.postgresql.org/download/linux/ubuntu/ - echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list curl "https://www.postgresql.org/media/keys/ACCC4CF8.asc" | sudo tee /etc/apt/trusted.gpg.d/postgresql.asc - sudo apt-get update + echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list # will download ~9MB files and use ~55MB disk after installation - sudo apt-get -y install "postgresql-client-${VER_PG}" + sudo apt-get update && sudo apt-get -y install "postgresql-client-${VER_PG}" echo "@ Version of psql client: $(psql --version)" } setup_mysql_client() { - sudo apt-get update # will download ~5MB files and use ~76MB disk after installation - sudo apt-get -y install mysql-client + sudo apt-get update && sudo apt-get -y install mysql-client echo "@ Version of mysql client: $(mysql --version)" } setup_mongosh_client() { # from: https://www.mongodb.com/docs/mongodb-shell/install/ - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/6.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-6.0.list curl -sL https://www.mongodb.org/static/pgp/server-6.0.asc | sudo tee /etc/apt/trusted.gpg.d/mongodb.asc - sudo apt-get update + echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/6.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-6.0.list # will download ~38MB files and use ~218MB disk after installation - sudo apt-get -y install mongodb-mongosh + sudo apt-get update && sudo apt-get -y install mongodb-mongosh echo "@ Version of mongosh client: $(mongosh --version)" } @@ -36,7 +33,6 @@ setup_redis_client() { # from https://redis.io/docs/getting-started/installation/install-redis-on-linux/ curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list - sudo apt-get update - sudo apt-get -y install redis-tools + sudo apt-get update && sudo apt-get -y install redis-tools echo "@ Version of redis-cli: $(redis-cli --version)" } From 7b6d1ccf4c8709d1a248003e70aa22f61cdc7c72 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Mon, 24 Jun 2024 16:11:42 +0000 Subject: [PATCH 2/3] fix mirror --- .../work/localize/run-config-mirror-aliyun-pub.sh | 13 +++++++------ .../work/localize/run-config-mirror-aliyun-vpc.sh | 13 +++++++------ .../work/localize/run-config-mirror-tencent-pub.sh | 13 +++++++------ .../work/localize/run-config-mirror-tencent-vpc.sh | 13 +++++++------ .../work/localize/run-config-mirror-tsinghua.sh | 13 +++++++------ 5 files changed, 35 insertions(+), 30 deletions(-) diff --git a/docker_atom/work/localize/run-config-mirror-aliyun-pub.sh b/docker_atom/work/localize/run-config-mirror-aliyun-pub.sh index b0ad5df..f060187 100644 --- a/docker_atom/work/localize/run-config-mirror-aliyun-pub.sh +++ b/docker_atom/work/localize/run-config-mirror-aliyun-pub.sh @@ -8,13 +8,14 @@ ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone echo "Setup timezone, current date: $(date)" eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}" +FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list ) +FILE_YUM=$([ -f /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ] && echo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ) -if [ -f /etc/apt/sources.list ]; then - [ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && ln -sf /etc/apt/sources.list.d/${OS_ID}.sources /etc/apt/sources.list - sed -i 's/mirrors.*.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/security.ubuntu.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/deb.debian.org\/debian/mirrors.aliyun.com\/debian/' /etc/apt/sources.list +if [ -f $FILE_DEB ]; then + sed -i 's/mirrors.*.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' $FILE_DEB + sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' $FILE_DEB + sed -i 's/security.ubuntu.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' $FILE_DEB + sed -i 's/deb.debian.org\/debian/mirrors.aliyun.com\/debian/' $FILE_DEB echo "Finished setting ubuntu/debian mirror" fi diff --git a/docker_atom/work/localize/run-config-mirror-aliyun-vpc.sh b/docker_atom/work/localize/run-config-mirror-aliyun-vpc.sh index 8f9197b..f7d9ab5 100644 --- a/docker_atom/work/localize/run-config-mirror-aliyun-vpc.sh +++ b/docker_atom/work/localize/run-config-mirror-aliyun-vpc.sh @@ -8,13 +8,14 @@ ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone echo "Setup timezone, current date: $(date)" eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}" +FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list ) +FILE_YUM=$([ -f /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ] && echo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ) -if [ -f /etc/apt/sources.list ]; then - [ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && ln -sf /etc/apt/sources.list.d/${OS_ID}.sources /etc/apt/sources.list - sed -i 's/mirrors.*.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/security.ubuntu.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/deb.debian.org\/debian/mirrors.cloud.aliyuncs.com\/debian/' /etc/apt/sources.list +if [ -f $FILE_DEB ]; then + sed -i 's/mirrors.*.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' $FILE_DEB + sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' $FILE_DEB + sed -i 's/security.ubuntu.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' $FILE_DEB + sed -i 's/deb.debian.org\/debian/mirrors.cloud.aliyuncs.com\/debian/' $FILE_DEB echo "Finished setting ubuntu/debian mirror" fi diff --git a/docker_atom/work/localize/run-config-mirror-tencent-pub.sh b/docker_atom/work/localize/run-config-mirror-tencent-pub.sh index 54a4906..1a3e45a 100644 --- a/docker_atom/work/localize/run-config-mirror-tencent-pub.sh +++ b/docker_atom/work/localize/run-config-mirror-tencent-pub.sh @@ -8,13 +8,14 @@ ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone echo "Setup timezone, current date: $(date)" eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}" +FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list ) +FILE_YUM=$([ -f /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ] && echo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ) -if [ -f /etc/apt/sources.list ]; then - [ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && ln -sf /etc/apt/sources.list.d/${OS_ID}.sources /etc/apt/sources.list - sed -i 's/mirrors.*.com\/ubuntu/mirrors.tencent.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tencent.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/security.ubuntu.com\/ubuntu/mirrors.tencent.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/deb.debian.org\/debian/mirrors.tencent.com\/debian/' /etc/apt/sources.list +if [ -f $FILE_DEB ]; then + sed -i 's/mirrors.*.com\/ubuntu/mirrors.tencent.com\/ubuntu/' $FILE_DEB + sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tencent.com\/ubuntu/' $FILE_DEB + sed -i 's/security.ubuntu.com\/ubuntu/mirrors.tencent.com\/ubuntu/' $FILE_DEB + sed -i 's/deb.debian.org\/debian/mirrors.tencent.com\/debian/' $FILE_DEB echo "Finished setting ubuntu/debian mirror" fi diff --git a/docker_atom/work/localize/run-config-mirror-tencent-vpc.sh b/docker_atom/work/localize/run-config-mirror-tencent-vpc.sh index a237b2a..5f4155c 100644 --- a/docker_atom/work/localize/run-config-mirror-tencent-vpc.sh +++ b/docker_atom/work/localize/run-config-mirror-tencent-vpc.sh @@ -8,13 +8,14 @@ ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone echo "Setup timezone, current date: $(date)" eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}" +FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list ) +FILE_YUM=$([ -f /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ] && echo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ) -if [ -f /etc/apt/sources.list ]; then - [ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && ln -sf /etc/apt/sources.list.d/${OS_ID}.sources /etc/apt/sources.list - sed -i 's/mirrors.*.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/security.ubuntu.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' /etc/apt/sources.list - sed -i 's/deb.debian.org\/debian/mirrors.tencentyun.com\/debian/' /etc/apt/sources.list +if [ -f $FILE_DEB ]; then + sed -i 's/mirrors.*.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' $FILE_DEB + sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' $FILE_DEB + sed -i 's/security.ubuntu.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' $FILE_DEB + sed -i 's/deb.debian.org\/debian/mirrors.tencentyun.com\/debian/' $FILE_DEB echo "Finished setting ubuntu/debian mirror" fi diff --git a/docker_atom/work/localize/run-config-mirror-tsinghua.sh b/docker_atom/work/localize/run-config-mirror-tsinghua.sh index 41899dd..d0c249b 100644 --- a/docker_atom/work/localize/run-config-mirror-tsinghua.sh +++ b/docker_atom/work/localize/run-config-mirror-tsinghua.sh @@ -8,13 +8,14 @@ ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone echo "Setup timezone, current date: $(date)" eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}" +FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list ) +FILE_YUM=$([ -f /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ] && echo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ) -if [ -f /etc/apt/sources.list ]; then - [ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && ln -sf /etc/apt/sources.list.d/${OS_ID}.sources /etc/apt/sources.list - sed -i 's/mirrors.*.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' /etc/apt/sources.list - sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' /etc/apt/sources.list - sed -i 's/security.ubuntu.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' /etc/apt/sources.list - sed -i 's/deb.debian.org\/debian/mirrors.tuna.tsinghua.edu.cn\/debian/' /etc/apt/sources.list +if [ -f $FILE_DEB ]; then + sed -i 's/mirrors.*.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' $FILE_DEB + sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' $FILE_DEB + sed -i 's/security.ubuntu.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' $FILE_DEB + sed -i 's/deb.debian.org\/debian/mirrors.tuna.tsinghua.edu.cn\/debian/' $FILE_DEB echo "Finished setting ubuntu/debian mirror" fi From dce6a9e8da4ee319b0b5899b1f49eb0025c585ee Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Mon, 24 Jun 2024 16:20:28 +0000 Subject: [PATCH 3/3] fix mirror 2 --- docker_atom/work/localize/run-config-mirror-aliyun-pub.sh | 3 +-- docker_atom/work/localize/run-config-mirror-aliyun-vpc.sh | 3 +-- docker_atom/work/localize/run-config-mirror-tencent-pub.sh | 3 +-- docker_atom/work/localize/run-config-mirror-tencent-vpc.sh | 3 +-- docker_atom/work/localize/run-config-mirror-tsinghua.sh | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/docker_atom/work/localize/run-config-mirror-aliyun-pub.sh b/docker_atom/work/localize/run-config-mirror-aliyun-pub.sh index f060187..33b99e2 100644 --- a/docker_atom/work/localize/run-config-mirror-aliyun-pub.sh +++ b/docker_atom/work/localize/run-config-mirror-aliyun-pub.sh @@ -8,9 +8,8 @@ ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone echo "Setup timezone, current date: $(date)" eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}" -FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list ) -FILE_YUM=$([ -f /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ] && echo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ) +FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list ) if [ -f $FILE_DEB ]; then sed -i 's/mirrors.*.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' $FILE_DEB sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' $FILE_DEB diff --git a/docker_atom/work/localize/run-config-mirror-aliyun-vpc.sh b/docker_atom/work/localize/run-config-mirror-aliyun-vpc.sh index f7d9ab5..e7e03d8 100644 --- a/docker_atom/work/localize/run-config-mirror-aliyun-vpc.sh +++ b/docker_atom/work/localize/run-config-mirror-aliyun-vpc.sh @@ -8,9 +8,8 @@ ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone echo "Setup timezone, current date: $(date)" eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}" -FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list ) -FILE_YUM=$([ -f /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ] && echo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ) +FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list ) if [ -f $FILE_DEB ]; then sed -i 's/mirrors.*.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' $FILE_DEB sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' $FILE_DEB diff --git a/docker_atom/work/localize/run-config-mirror-tencent-pub.sh b/docker_atom/work/localize/run-config-mirror-tencent-pub.sh index 1a3e45a..04f7a52 100644 --- a/docker_atom/work/localize/run-config-mirror-tencent-pub.sh +++ b/docker_atom/work/localize/run-config-mirror-tencent-pub.sh @@ -8,9 +8,8 @@ ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone echo "Setup timezone, current date: $(date)" eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}" -FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list ) -FILE_YUM=$([ -f /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ] && echo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ) +FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list ) if [ -f $FILE_DEB ]; then sed -i 's/mirrors.*.com\/ubuntu/mirrors.tencent.com\/ubuntu/' $FILE_DEB sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tencent.com\/ubuntu/' $FILE_DEB diff --git a/docker_atom/work/localize/run-config-mirror-tencent-vpc.sh b/docker_atom/work/localize/run-config-mirror-tencent-vpc.sh index 5f4155c..891b73d 100644 --- a/docker_atom/work/localize/run-config-mirror-tencent-vpc.sh +++ b/docker_atom/work/localize/run-config-mirror-tencent-vpc.sh @@ -8,9 +8,8 @@ ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone echo "Setup timezone, current date: $(date)" eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}" -FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list ) -FILE_YUM=$([ -f /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ] && echo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ) +FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list ) if [ -f $FILE_DEB ]; then sed -i 's/mirrors.*.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' $FILE_DEB sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' $FILE_DEB diff --git a/docker_atom/work/localize/run-config-mirror-tsinghua.sh b/docker_atom/work/localize/run-config-mirror-tsinghua.sh index d0c249b..3953c93 100644 --- a/docker_atom/work/localize/run-config-mirror-tsinghua.sh +++ b/docker_atom/work/localize/run-config-mirror-tsinghua.sh @@ -8,9 +8,8 @@ ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone echo "Setup timezone, current date: $(date)" eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}" -FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list ) -FILE_YUM=$([ -f /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ] && echo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo ) +FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list ) if [ -f $FILE_DEB ]; then sed -i 's/mirrors.*.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' $FILE_DEB sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' $FILE_DEB