From ceb0454e11ebcda3449621d469deaf1ff575d132 Mon Sep 17 00:00:00 2001
From: Sergei Bobkov <sergant@git.aassdd.ru>
Date: Fri, 3 Jan 2025 15:00:11 +0300
Subject: [PATCH] Add apt-mirror for Ubuntu 24

---
 apt-mirror-server/etc/apt/mirror.list.def     | 34 -------
 .../apt/{mirror.list => mirror_deb12.list}    |  0
 apt-mirror-server/etc/apt/mirror_ubn24.list   | 27 ++++++
 .../etc/nginx/sites-available/default.def     | 91 -------------------
 .../{default => default_deb12}                |  0
 .../etc/nginx/sites-available/default_ubn24   | 25 +++++
 6 files changed, 52 insertions(+), 125 deletions(-)
 delete mode 100644 apt-mirror-server/etc/apt/mirror.list.def
 rename apt-mirror-server/etc/apt/{mirror.list => mirror_deb12.list} (100%)
 create mode 100644 apt-mirror-server/etc/apt/mirror_ubn24.list
 delete mode 100644 apt-mirror-server/etc/nginx/sites-available/default.def
 rename apt-mirror-server/etc/nginx/sites-available/{default => default_deb12} (100%)
 create mode 100644 apt-mirror-server/etc/nginx/sites-available/default_ubn24

diff --git a/apt-mirror-server/etc/apt/mirror.list.def b/apt-mirror-server/etc/apt/mirror.list.def
deleted file mode 100644
index 53e1dbf..0000000
--- a/apt-mirror-server/etc/apt/mirror.list.def
+++ /dev/null
@@ -1,34 +0,0 @@
-############# config ##################
-#
-# set base_path    /var/spool/apt-mirror
-#
-# set mirror_path  $base_path/mirror
-# set skel_path    $base_path/skel
-# set var_path     $base_path/var
-# set cleanscript $var_path/clean.sh
-# set defaultarch  <running host architecture>
-# set postmirror_script $var_path/postmirror.sh
-# set run_postmirror 0
-set nthreads     20
-set _tilde 0
-#
-############# end config ##############
-
-deb http://ftp.us.debian.org/debian unstable main contrib non-free
-deb-src http://ftp.us.debian.org/debian unstable main contrib non-free
-
-# mirror additional architectures
-#deb-alpha http://ftp.us.debian.org/debian unstable main contrib non-free
-#deb-amd64 http://ftp.us.debian.org/debian unstable main contrib non-free
-#deb-armel http://ftp.us.debian.org/debian unstable main contrib non-free
-#deb-hppa http://ftp.us.debian.org/debian unstable main contrib non-free
-#deb-i386 http://ftp.us.debian.org/debian unstable main contrib non-free
-#deb-ia64 http://ftp.us.debian.org/debian unstable main contrib non-free
-#deb-m68k http://ftp.us.debian.org/debian unstable main contrib non-free
-#deb-mips http://ftp.us.debian.org/debian unstable main contrib non-free
-#deb-mipsel http://ftp.us.debian.org/debian unstable main contrib non-free
-#deb-powerpc http://ftp.us.debian.org/debian unstable main contrib non-free
-#deb-s390 http://ftp.us.debian.org/debian unstable main contrib non-free
-#deb-sparc http://ftp.us.debian.org/debian unstable main contrib non-free
-
-clean http://ftp.us.debian.org/debian
diff --git a/apt-mirror-server/etc/apt/mirror.list b/apt-mirror-server/etc/apt/mirror_deb12.list
similarity index 100%
rename from apt-mirror-server/etc/apt/mirror.list
rename to apt-mirror-server/etc/apt/mirror_deb12.list
diff --git a/apt-mirror-server/etc/apt/mirror_ubn24.list b/apt-mirror-server/etc/apt/mirror_ubn24.list
new file mode 100644
index 0000000..6b18e72
--- /dev/null
+++ b/apt-mirror-server/etc/apt/mirror_ubn24.list
@@ -0,0 +1,27 @@
+#### START /etc/apt/mirror.list ####
+
+set base_path     /DATA/repos
+set mirror_path   $base_path/mirror
+set skel_path     $base_path/skel
+set var_path      $base_path/var
+set cleanscript   $var_path/clean.sh
+set _autoclean    1
+
+set use_proxy             on
+set http_proxy            http://10.8.254.254:3128
+set https_proxy           http://10.8.254.254:3128
+
+#set postmirror_script $var_path/postmirror.sh
+set run_postmirror 0
+
+set nthreads       40
+set _tilde         0
+
+
+deb-amd64  http://archive.ubuntu.com/ubuntu noble main restricted universe multiverse
+deb-amd64  http://archive.ubuntu.com/ubuntu noble-security main restricted universe multiverse
+deb-amd64  http://archive.ubuntu.com/ubuntu noble-updates main restricted universe multiverse
+
+clean http://archive.ubuntu.com/ubuntu
+
+#### End ####
diff --git a/apt-mirror-server/etc/nginx/sites-available/default.def b/apt-mirror-server/etc/nginx/sites-available/default.def
deleted file mode 100644
index 6f0e2f0..0000000
--- a/apt-mirror-server/etc/nginx/sites-available/default.def
+++ /dev/null
@@ -1,91 +0,0 @@
-##
-# You should look at the following URL's in order to grasp a solid understanding
-# of Nginx configuration files in order to fully unleash the power of Nginx.
-# https://www.nginx.com/resources/wiki/start/
-# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
-# https://wiki.debian.org/Nginx/DirectoryStructure
-#
-# In most cases, administrators will remove this file from sites-enabled/ and
-# leave it as reference inside of sites-available where it will continue to be
-# updated by the nginx packaging team.
-#
-# This file will automatically load configuration files provided by other
-# applications, such as Drupal or Wordpress. These applications will be made
-# available underneath a path with that package name, such as /drupal8.
-#
-# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
-##
-
-# Default server configuration
-#
-server {
-	listen 80 default_server;
-#	listen [::]:80 default_server;
-
-	# SSL configuration
-	#
-	# listen 443 ssl default_server;
-	# listen [::]:443 ssl default_server;
-	#
-	# Note: You should disable gzip for SSL traffic.
-	# See: https://bugs.debian.org/773332
-	#
-	# Read up on ssl_ciphers to ensure a secure configuration.
-	# See: https://bugs.debian.org/765782
-	#
-	# Self signed certs generated by the ssl-cert package
-	# Don't use them in a production server!
-	#
-	# include snippets/snakeoil.conf;
-
-	root /var/www/html;
-
-	# Add index.php to the list if you are using PHP
-	index index.html index.htm index.nginx-debian.html;
-
-	server_name _;
-
-	location / {
-		# First attempt to serve request as file, then
-		# as directory, then fall back to displaying a 404.
-		try_files $uri $uri/ =404;
-	}
-
-	# pass PHP scripts to FastCGI server
-	#
-	#location ~ \.php$ {
-	#	include snippets/fastcgi-php.conf;
-	#
-	#	# With php-fpm (or other unix sockets):
-	#	fastcgi_pass unix:/run/php/php7.4-fpm.sock;
-	#	# With php-cgi (or other tcp sockets):
-	#	fastcgi_pass 127.0.0.1:9000;
-	#}
-
-	# deny access to .htaccess files, if Apache's document root
-	# concurs with nginx's one
-	#
-	#location ~ /\.ht {
-	#	deny all;
-	#}
-}
-
-
-# Virtual Host configuration for example.com
-#
-# You can move that to a different file under sites-available/ and symlink that
-# to sites-enabled/ to enable it.
-#
-#server {
-#	listen 80;
-#	listen [::]:80;
-#
-#	server_name example.com;
-#
-#	root /var/www/example.com;
-#	index index.html;
-#
-#	location / {
-#		try_files $uri $uri/ =404;
-#	}
-#}
diff --git a/apt-mirror-server/etc/nginx/sites-available/default b/apt-mirror-server/etc/nginx/sites-available/default_deb12
similarity index 100%
rename from apt-mirror-server/etc/nginx/sites-available/default
rename to apt-mirror-server/etc/nginx/sites-available/default_deb12
diff --git a/apt-mirror-server/etc/nginx/sites-available/default_ubn24 b/apt-mirror-server/etc/nginx/sites-available/default_ubn24
new file mode 100644
index 0000000..c486015
--- /dev/null
+++ b/apt-mirror-server/etc/nginx/sites-available/default_ubn24
@@ -0,0 +1,25 @@
+# Default server configuration
+#
+server {
+        listen 80 default_server;
+        root /var/www/html;
+
+        # Add index.php to the list if you are using PHP
+
+        index index.html index.htm index.nginx-debian.html;
+
+        server_name _;
+
+        location / {
+                # First attempt to serve request as file, then
+                # as directory, then fall back to displaying a 404.
+                try_files $uri $uri/ =404;
+        }
+
+        location /ubuntu/ {
+                root /DATA/repos/mirror/archive.ubuntu.com;
+                autoindex on;
+                index index.html index.htm;
+        }
+
+}