From 31fd37e651d54af5ea8e4ef62fa95861c0c63242 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 21 Nov 2023 19:55:36 +0800 Subject: docker(debian-dev): improve apt-source. --- docker/debian-dev/bootstrap/apt-source/install-apt-https.bash | 7 +++++++ docker/debian-dev/bootstrap/apt-source/replace-domain.bash | 4 ++-- docker/debian-dev/bootstrap/apt-source/replace-http.bash | 9 +++------ docker/debian-dev/bootstrap/apt-source/setup.bash | 1 + 4 files changed, 13 insertions(+), 8 deletions(-) create mode 100755 docker/debian-dev/bootstrap/apt-source/install-apt-https.bash (limited to 'docker/debian-dev/bootstrap') diff --git a/docker/debian-dev/bootstrap/apt-source/install-apt-https.bash b/docker/debian-dev/bootstrap/apt-source/install-apt-https.bash new file mode 100755 index 0000000..05d372b --- /dev/null +++ b/docker/debian-dev/bootstrap/apt-source/install-apt-https.bash @@ -0,0 +1,7 @@ +#! /usr/bin/env bash + +set -e + +echo "Install apt https transport." +apt-get update +apt-get install -y apt-transport-https ca-certificates diff --git a/docker/debian-dev/bootstrap/apt-source/replace-domain.bash b/docker/debian-dev/bootstrap/apt-source/replace-domain.bash index cef36a3..86e88dc 100755 --- a/docker/debian-dev/bootstrap/apt-source/replace-domain.bash +++ b/docker/debian-dev/bootstrap/apt-source/replace-domain.bash @@ -2,6 +2,6 @@ set -e +echo "Backup /etc/apt/sources.list to /etc/apt/sources.list.bak." +echo "Replace source domain in /etc/apt/sources.list to $1." sed -i.bak "s|\(https\?://\)[-_.a-zA-Z0-9]\+/|\\1$1/|" /etc/apt/sources.list -apt-get update - diff --git a/docker/debian-dev/bootstrap/apt-source/replace-http.bash b/docker/debian-dev/bootstrap/apt-source/replace-http.bash index b5f6cca..fae082a 100755 --- a/docker/debian-dev/bootstrap/apt-source/replace-http.bash +++ b/docker/debian-dev/bootstrap/apt-source/replace-http.bash @@ -2,9 +2,6 @@ set -e -apt-get update -apt-get install -y apt-transport-https ca-certificates - -sed -i.bak 's/https?/https/' /etc/apt/sources.list -apt-get update - +echo "Backup /etc/apt/sources.list to /etc/apt/sources.list.bak." +echo "Replace http to https in /etc/apt/sources.list." +sed -i.bak 's/https\?/https/' /etc/apt/sources.list diff --git a/docker/debian-dev/bootstrap/apt-source/setup.bash b/docker/debian-dev/bootstrap/apt-source/setup.bash index 9f74cb6..36065f6 100755 --- a/docker/debian-dev/bootstrap/apt-source/setup.bash +++ b/docker/debian-dev/bootstrap/apt-source/setup.bash @@ -8,5 +8,6 @@ if [[ -n $IN_CHINA ]]; then "$dir/replace-domain.bash" $(cat "$dir/china-source.txt") fi +"$dir/install-apt-https.bash" "$dir/replace-http.bash" -- cgit v1.2.3