aboutsummaryrefslogtreecommitdiff
path: root/docker/debian-dev/bootstrap/apt-source/12
diff options
context:
space:
mode:
Diffstat (limited to 'docker/debian-dev/bootstrap/apt-source/12')
-rw-r--r--docker/debian-dev/bootstrap/apt-source/12/add-deb-src.bash22
-rw-r--r--docker/debian-dev/bootstrap/apt-source/12/get-domain.bash6
-rw-r--r--docker/debian-dev/bootstrap/apt-source/12/replace-domain.bash7
-rw-r--r--docker/debian-dev/bootstrap/apt-source/12/replace-http.bash7
4 files changed, 42 insertions, 0 deletions
diff --git a/docker/debian-dev/bootstrap/apt-source/12/add-deb-src.bash b/docker/debian-dev/bootstrap/apt-source/12/add-deb-src.bash
new file mode 100644
index 0000000..cf741d6
--- /dev/null
+++ b/docker/debian-dev/bootstrap/apt-source/12/add-deb-src.bash
@@ -0,0 +1,22 @@
+#! /usr/bin/env bash
+
+set -e
+
+dir=$(dirname "$0")
+domain=$("$dir/get-domain.bash")
+
+cat <<EOF >> /etc/apt/sources.list.d/debian.sources
+
+Types: deb-src
+URIs: https://$domain/debian
+Suites: bookworm bookworm-updates
+Components: main
+Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
+
+Types: deb-src
+URIs: https://$domain/debian-security
+Suites: bookworm-security
+Components: main
+Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
+
+EOF \ No newline at end of file
diff --git a/docker/debian-dev/bootstrap/apt-source/12/get-domain.bash b/docker/debian-dev/bootstrap/apt-source/12/get-domain.bash
new file mode 100644
index 0000000..a24538c
--- /dev/null
+++ b/docker/debian-dev/bootstrap/apt-source/12/get-domain.bash
@@ -0,0 +1,6 @@
+#! /usr/bin/env bash
+
+set -e
+
+grep -e 'URIs:' /etc/apt/sources.list.d/debian.sources | \
+ sed -E 's|URIs:\s*https?://([-_.a-zA-Z0-9]+)/.*|\1|;q'
diff --git a/docker/debian-dev/bootstrap/apt-source/12/replace-domain.bash b/docker/debian-dev/bootstrap/apt-source/12/replace-domain.bash
new file mode 100644
index 0000000..d55307c
--- /dev/null
+++ b/docker/debian-dev/bootstrap/apt-source/12/replace-domain.bash
@@ -0,0 +1,7 @@
+#! /usr/bin/env bash
+
+set -e
+
+echo "Backup /etc/apt/sources.list.d/debian.sources to /etc/apt/sources.list.d/debian.sources.bak."
+echo "Replace source domain in /etc/apt/sources.list.d/debian.sources to $1."
+sed -i.bak -E "s|(URIs:\\s*https?://)[-_.a-zA-Z0-9]+(/.*)|\\1$1\\2|" /etc/apt/sources.list.d/debian.sources
diff --git a/docker/debian-dev/bootstrap/apt-source/12/replace-http.bash b/docker/debian-dev/bootstrap/apt-source/12/replace-http.bash
new file mode 100644
index 0000000..ed4391d
--- /dev/null
+++ b/docker/debian-dev/bootstrap/apt-source/12/replace-http.bash
@@ -0,0 +1,7 @@
+#! /usr/bin/env bash
+
+set -e
+
+echo "Backup /etc/apt/sources.list to /etc/apt/sources.list.d/debian.sources.bak."
+echo "Replace http to https in /etc/apt/sources.list.d/debian.sources."
+sed -i.bak -E "s|(URIs:\\s*)https?(://[-_.a-zA-Z0-9]+/.*)|\\1https\\2|" /etc/apt/sources.list.d/debian.sources