|
|
||
|---|---|---|
| docker@4c4ed58821 | ||
| .gitmodules | ||
| README.md | ||
| README.txt | ||
| build_rootfs_bookworm.sh | ||
| build_rootfs_bookworm.sh-20231007T150030Z | ||
| build_rootfs_bullseye.sh | ||
| build_rootfs_bullseye.sh-20231007T150030Z | ||
| build_rootfs_buster.sh | ||
| build_rootfs_buster.sh-20230611T103552Z | ||
| build_rootfs_jessie.sh | ||
| build_rootfs_jessie.sh-20180623T023722Z | ||
| build_rootfs_stretch.sh | ||
| build_rootfs_stretch.sh-20200717T204551Z | ||
| build_rootfs_trixie.sh | ||
| build_rootfs_wheezy-dselect.sh | ||
| build_rootfs_wheezy.sh | ||
| debian-8.gpg | ||
| debian-9.gpg | ||
| debian-10.gpg | ||
| debian-11.gpg | ||
| debian-12.gpg | ||
| debian-release-8.gpg | ||
| debian-release-9.gpg | ||
| debian-release-10.gpg | ||
| debian-release-11.gpg | ||
| debian-release-12.gpg | ||
| devuan-debian_releases | ||
| evolution.upgrade.txt | ||
| fetch-keyring.sh | ||
| fetch-package-datecode.sh | ||
| fetch-package-datecode_release-date.sh | ||
| packages.list_tonny-20170617T034212Z | ||
| replacement_log.txt | ||
| rootfs_bookworm-20231007T150030Z.tar.xz | ||
| rootfs_bullseye-20231007T150030Z.tar.xz | ||
| rootfs_buster-20230611T103552Z.tar.xz | ||
| rootfs_jessie-20180623T023722Z.tar.xz | ||
| rootfs_stretch-20200717T204551Z.tar.xz | ||
README.md
Debian Snapshot Docker Image Creation Scripts
The goal is to create a Docker image that can run a version of Debian currently running on an aging laptop, ensuring access to email and other data before the laptop's hard drive fails. It involves getting the date/release name of the current installation, using debuerreotype to build a rootfs, creating a Docker image with the debuerreotype rootfs, and mounting a copy of the /home/tonny directory in the Docker container.
This repository contains scripts designed to facilitate the creation of Docker images based on Debian snapshots. The primary motivation behind these scripts was to address the challenge of using dselect within Docker containers, which led to the development of a method to include necessary packages directly in the root filesystem (rootfs) used by FROM scratch Dockerfiles. However, it is recommended to install the required application directly in the Dockerfile for simplicity and efficiency.
Scripts Overview
build_rootfs_<RELEASE_NAME>.sh
This script automates the process of setting up a Debian-based Docker image, focusing on specific release quirks. It outputs a root filesystem tarball and a corresponding build script with a matching tag. The key tasks performed by this script include:
- Setting Up Variables: Initializes variables for release name, number, target directory, source date, release date, root filesystem tarball name, keyring date, and a flag for host keys.
- Keyring Management: Uses the system's keyring or downloads a specific keyring from the Debian snapshot archive, ensuring package authenticity.
- Initializing the Chroot Environment: Sets up a chroot environment with the specified Debian release and date using
debuerreotype-init. - Installing Snapshot Keyring: Downloads and installs the Debian snapshot keyring within the chroot environment.
- Adding Fingerprints: Adds necessary GPG keys to the chroot environment for package authenticity.
- Configuring APT Sources: Configures APT sources to use the Debian snapshot archive.
- APT Configuration: Applies APT configurations to optimize package installation and minimize the root filesystem size.
- Package Installation: Installs necessary packages within the chroot environment.
- Minimizing and Slimifying: Applies configurations to reduce the root filesystem size.
- Taring the Root Filesystem: Creates a tarball of the root filesystem for Docker image building.
fetch-keyring.sh
This script finds and retrieves the appropriate debian-archive-keyring package for a given date, useful when working with Debian snapshots or specific release dates. It processes the date string, retrieves keyring versions, sorts and filters them, and outputs the selected keyring.
-
Define a Function: It defines a function named get_keyring that takes a date string as an argument. If no argument is provided, it defaults to a specific date (20190608T160814Z).
-
Process the Date String: The function processes the date string to remove any prefix and convert it into a standardized format (YYYY-MM-DDTHH:MM:SSZ).
-
Retrieve Keyring Versions: It fetches a list of available debian-archive-keyring versions from the Debian snapshot archive using curl and jq to parse the JSON response.
-
Sort and Filter Keyrings: The script sorts the retrieved keyring versions in reverse order and filters them to find the version that was first seen closest to but not later than the given date.
-
Output the Selected Keyring: Finally, it outputs the name of the selected debian-archive-keyring package, which can then be used for further operations, such as downloading or installing the keyring.
fetch-package-datecode_release-date.sh
Retrieves the date code for a specific package and version from the Debian snapshot archive, tracking the first appearance of a package version. It constructs URLs to query the archive, extracts the hash of the package version, and outputs the date code of the first appearance.
-
Define a Function: It defines a function named get_date_code that takes two arguments: the package name and the version. If no arguments are provided, it defaults to "evolution" and "3.38.3-1+deb11u2".
-
Construct the URL: The function constructs a URL to query the Debian snapshot archive for the specified package and version.
-
Send a GET Request: It sends a GET request to the constructed URL and parses the JSON response using curl and jq to extract the hash of the package version.
-
Retrieve Date Code: The script then constructs another URL to query the archive for the first appearance of the package version using the extracted hash. It sends another GET request and parses the JSON response to extract the date code of the first appearance.
-
Output the Date Code: Finally, it outputs the date code, which represents the first time the specified package version was seen in the Debian snapshot archive.
Usage
- Get the date/release name of the current installation to build a rootfs for Docker using
debuerreotype. - Create a Docker image using the
debuerreotyperootfs in theFROMdirective of the Dockerfile and useget-selectionson the laptop to provide aset-selectionsfile for the Dockerfile. - Mount a copy of the
/home/tonnydirectory in the Docker container and start the container with access to the running X server.
Note
If using older snapshots, you may need to boot your host with the vsyscall=emulate kernel option to avoid broken chroot behavior. It's recommended to add this option at boot rather than permanently modifying the GRUB configuration.