diff options
Diffstat (limited to 'docker/debian-dev/bootstrap/apt-source')
5 files changed, 36 insertions, 0 deletions
diff --git a/docker/debian-dev/bootstrap/apt-source/china-source.txt b/docker/debian-dev/bootstrap/apt-source/china-source.txt new file mode 100644 index 0000000..3821ffc --- /dev/null +++ b/docker/debian-dev/bootstrap/apt-source/china-source.txt @@ -0,0 +1 @@ +mirrors.ustc.edu.cn diff --git a/docker/debian-dev/bootstrap/apt-source/get-domain.bash b/docker/debian-dev/bootstrap/apt-source/get-domain.bash new file mode 100755 index 0000000..c9b93b1 --- /dev/null +++ b/docker/debian-dev/bootstrap/apt-source/get-domain.bash @@ -0,0 +1,6 @@ +#! /usr/bin/env bash + +set -e + +sed "s|.*https\?://\([-_.a-zA-Z0-9]\+\)/.*|\\1|;q" /etc/apt/sources.list + diff --git a/docker/debian-dev/bootstrap/apt-source/replace-domain.bash b/docker/debian-dev/bootstrap/apt-source/replace-domain.bash new file mode 100755 index 0000000..cef36a3 --- /dev/null +++ b/docker/debian-dev/bootstrap/apt-source/replace-domain.bash @@ -0,0 +1,7 @@ +#! /usr/bin/env bash + +set -e + +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 new file mode 100755 index 0000000..b5f6cca --- /dev/null +++ b/docker/debian-dev/bootstrap/apt-source/replace-http.bash @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +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 + diff --git a/docker/debian-dev/bootstrap/apt-source/setup.bash b/docker/debian-dev/bootstrap/apt-source/setup.bash new file mode 100755 index 0000000..9f74cb6 --- /dev/null +++ b/docker/debian-dev/bootstrap/apt-source/setup.bash @@ -0,0 +1,12 @@ +#! /usr/bin/env bash + +set -e + +dir=$(dirname $0) + +if [[ -n $IN_CHINA ]]; then + "$dir/replace-domain.bash" $(cat "$dir/china-source.txt") +fi + +"$dir/replace-http.bash" + |