Compare commits

...

15 Commits

Author SHA1 Message Date
david bf87a42885 Added line 6
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, bookworm) (push) Failing after 5m46s Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, bullseye) (push) Failing after 4m18s Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, sid) (push) Failing after 5m21s Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, trixie) (push) Failing after 5m34s Details
sd-card-images CI / build docker images (push) Has been skipped Details
2024-05-21 22:16:42 +01:00
david f85f0b1e65 Added line 5 2024-05-21 22:16:15 +01:00
david d7548debd0 Added line 4 2024-05-21 22:15:56 +01:00
david 151996b827 Added line 3 2024-05-21 22:15:39 +01:00
david 99c62e6028 Added line 2 2024-05-21 22:15:14 +01:00
david 56883b6570 Added line 1 2024-05-21 22:14:38 +01:00
david 35089ec760 README_devuan.md: Extend description and examples.
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, bookworm) (push) Failing after 4m14s Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, sid) (push) Has been cancelled Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, trixie) (push) Has been cancelled Details
sd-card-images CI / build docker images (push) Has been cancelled Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, bullseye) (push) Has been cancelled Details
2024-05-18 22:20:06 +01:00
david 43b68563da Dockerfile.devuan: Add, based on Devuan image. 2024-05-18 22:18:06 +01:00
david cc9c861c0d build-debian: Add Devuan keys to fetch Devuan debootstrap on Debian. 2024-05-18 20:18:28 +01:00
david f9cc428ca9 README_devuan.md: Extend instructions. 2024-05-18 20:16:24 +01:00
david e475fd11ac chore: build-debian: revert layout of debootstrap commands
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, bullseye) (push) Has been cancelled Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, sid) (push) Has been cancelled Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, trixie) (push) Has been cancelled Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, bookworm) (push) Has been cancelled Details
sd-card-images CI / build docker images (push) Has been cancelled Details
2024-05-14 01:39:32 +01:00
david 287dd113ad Add Dockerfile to build Devuan Linux images.
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, bookworm) (push) Failing after 14m21s Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, bullseye) (push) Failing after 6m18s Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, trixie) (push) Has been cancelled Details
sd-card-images CI / build docker images (push) Has been cancelled Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, sid) (push) Has been cancelled Details
Dockerfile_devuan is FROM devuan/devuan:daedalus

README_devuan.md
2024-05-12 17:47:10 +01:00
david aeca8502e7 build-debian: Add support for Devuan Linux images.
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, sid) (push) Waiting to run Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, trixie) (push) Waiting to run Details
sd-card-images CI / build docker images (push) Blocked by required conditions Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, bookworm) (push) Failing after 5m29s Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, bullseye) (push) Has been cancelled Details
2024-05-12 17:33:04 +01:00
david 13ab9f88d4 rebuild-debian-csv: Add Devuan Linux release names.
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, sid) (push) Waiting to run Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, trixie) (push) Waiting to run Details
sd-card-images CI / build docker images (push) Blocked by required conditions Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, bookworm) (push) Failing after 5m29s Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, bullseye) (push) Has been cancelled Details
Needs rebuild-debian-csv: Use dist names not ls-lR.gz.

debians-arm.csv
debians-x86.csv
2024-05-12 17:26:13 +01:00
david 4d56c211b7 rebuild-debian-csv: Use dist names not ls-lR.gz.
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, bullseye) (push) Waiting to run Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, sid) (push) Waiting to run Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, trixie) (push) Waiting to run Details
sd-card-images CI / build docker images (push) Blocked by required conditions Details
sd-card-images CI / test ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.suite }} (i386, debian, bookworm) (push) Has been cancelled Details
Get codenames from the package repository's web page, because
Devuan does not have an ls-lR.gz file.

Uses python3-lxml.
2024-05-12 17:21:07 +01:00
9 changed files with 577 additions and 17 deletions

View File

@ -21,6 +21,7 @@ RUN apt-get update && \
bison \
flex \
python3-dev \
python3-lxml \
python3-pkg-resources \
python3-pyelftools \
python3-setuptools \

60
Dockerfile.devuan Normal file
View File

@ -0,0 +1,60 @@
FROM devuan/devuan:daedalus
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get --assume-yes \
--no-install-recommends \
install debootstrap \
debian-archive-keyring \
ca-certificates \
qemu-user \
qemu-user-static \
qemu-system-arm \
qemu-system-x86 \
device-tree-compiler \
gcc \
gcc-arm-none-eabi \
make \
git \
bc \
bzip2 \
pigz \
bison \
flex \
python3-dev \
python3-lxml \
python3-pkg-resources \
python3-pyelftools \
python3-setuptools \
swig \
parted \
e2fsprogs \
dosfstools \
mtools \
pwgen \
libssl-dev \
libgnutls28-dev \
uuid-dev \
parallel \
ssh \
sshpass \
unzip && \
([ "$(uname -m)" = "aarch64" ] && \
apt-get --assume-yes \
install gcc-arm-linux-gnueabihf \
gcc-i686-linux-gnu \
gcc-x86-64-linux-gnu || :) && \
([ "$(uname -m)" = "x86_64" ] && \
apt-get --assume-yes \
install gcc-arm-linux-gnueabihf \
gcc-aarch64-linux-gnu \
gcc-i686-linux-gnu || :) && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -f /var/log/*.log
RUN wget -q "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -O "awscliv2.zip" && \
unzip -q awscliv2.zip && \
./aws/install && \
rm -rf aws
ENV PATH="/debimg/scripts:${PATH}"
COPY . /debimg
WORKDIR /debimg

59
Dockerfile_devuan Normal file
View File

@ -0,0 +1,59 @@
FROM devuan/devuan:daedalus
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get --assume-yes \
--no-install-recommends \
install debootstrap \
debian-archive-keyring \
ca-certificates \
qemu-user \
qemu-user-static \
qemu-system-arm \
qemu-system-x86 \
device-tree-compiler \
gcc \
gcc-arm-none-eabi \
make \
git \
bc \
bzip2 \
pigz \
bison \
flex \
python3-dev \
python3-pkg-resources \
python3-pyelftools \
python3-setuptools \
swig \
parted \
e2fsprogs \
dosfstools \
mtools \
pwgen \
libssl-dev \
libgnutls28-dev \
uuid-dev \
parallel \
ssh \
sshpass \
unzip && \
([ "$(uname -m)" = "aarch64" ] && \
apt-get --assume-yes \
install gcc-arm-linux-gnueabihf \
gcc-i686-linux-gnu \
gcc-x86-64-linux-gnu || :) && \
([ "$(uname -m)" = "x86_64" ] && \
apt-get --assume-yes \
install gcc-arm-linux-gnueabihf \
gcc-aarch64-linux-gnu \
gcc-i686-linux-gnu || :) && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -f /var/log/*.log
RUN wget -q "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -O "awscliv2.zip" && \
unzip -q awscliv2.zip && \
./aws/install && \
rm -rf aws
ENV PATH="/debimg/scripts:${PATH}"
COPY . /debimg
WORKDIR /debimg

177
README_devuan.md Normal file
View File

@ -0,0 +1,177 @@
# Devuan SD card images
This repository simply adds Devuan to a fork of https://github.com/johang/sd-card-images. Please do not report any Devuan-issues to johang.
That project describes itself as
```
a bunch of scripts to build SD card images that various single-board computers (SBC) can boot.
Emphasis is on pureness; pure Debian and pure mainline U-boot.
```
The main implementation change is that the Dockerfile (`Dockerfile.devuan`) uses `FROM devuan/devuan:daedalus`.
## Index
- [Pre-built images](#pre-built-images)
- [Usage](#usage)
- - [Build your own boot image](#build-your-own-boot-image)
- - [Build your own Devuan ext4 root filesystem image](#build-your-own-devuan-ext4-root-filesystem-image)
- [Examples](#examples)
- - [Example boot image](#example-boot-image)
- - - [To build a boot image for Raspberry Pi 3 B](#to-build-a-boot-image-for-raspberry-pi-3-b)
- - - [To build a boot image for Pine64 Rockpro64](#to-build-a-boot-image-for-pine64-rockpro64)
- - - [To build a boot image for Sinovoip Banana Pi M2 Zero](#to-build-a-boot-image-for-sinovoip-banana-pi-m2-zero)
- - [Example root filesystem image](#example-root-filesystem-image)
- - - [To build a Devuan ext4 root filesystem image for arm64](#to-build-a-devuan-ext4-root-filesystem-image-for-arm64)
- - - [To build a Devuan ext4 root filesystem image for armhf](#to-build-a-devuan-ext4-root-filesystem-image-for-armhf)
## Pre-built images
Pre-built images for Debian are available from the original project at [sd-card-images.johang.se](https://sd-card-images.johang.se).
There are no pre-built images for Devuan.
## If you have problems here ##
This project is just a fork. If anything works at all, credit goes to johang.
If you have problems building a Devuan image here, please first try to build a Debian image using https://github.com/johang/sd-card-images.
Please do not report any Devuan-issues to johang, his interest is in pure Debian.
## Usage
The generated SD card images are made up of two separate images:
- **boot-BOARD.bin**: Boot image that contains partition table, U-Boot and chip-specific code. The boot image will only work on the board it's built for. The filename indicates which board it's built for.
- **devuan-ARCH-VERSION-PASSWORD.bin**: Devuan ext4 root filesystem image that contains a complete Devuan installation, including kernel, initrd and device tree. This Devuan image is generic and will work on all chips and boards with the CPU architecture it's built for. The filename indicates Devuan version, CPU architecture and default root password.
These two images are the concatenated to a single image, which is then written to SD card, for example like this:
$ zcat boot-raspberrypi_3b.bin.gz devuan-daedalus-arm64-XXXXXX.bin.gz > sd-card.img
# dd if=sd-card.img of=/dev/sdXXX
### Build your own boot image
See many appropriate values of ```CHIP_ID``` at https://sd-card-images.johang.se/.
A full list of relevant ```CONFIG``` values is at https://github.com/u-boot/u-boot/tree/master/configs.
For any valid combination of:
| Variable | |
|----------|-------------------------|
| BOARD_ID | Your choice of name, e.g. bananapi, pinebook |
| CHIP_ID | e.g. allwinner-a10, rk3399 |
| CONFIG | e.g. Bananapi_defconfig, pinebook-pro-rk3399_defconfig |
| TUPLE | e.g. arm-linux-gnueabihf for armhf, aarch64-linux-gnu for arm64 |
To build:
```bash
docker build -t devuan/sd-images -f Dockerfile.devuan https://github.com/watchful-0wl/sd-card-images.git#add_devuan
mkdir -p /tmp/sd-images
docker run --rm \
-v /tmp/sd-images:/artifacts \
devuan/sd-images \
build-boot ${BOARD_ID} ${CHIP_ID} ${CONFIG} ${TUPLE}
```
The image will end up in /tmp/sd-images on the host as `${BOARD_ID}.bin.gz`.
### Build your own Devuan ext4 root filesystem image
For any valid combination provided by the distribution:
|Variable | | | |
|--------------|---|---|---|
| DISTRIBUTION | **Devuan** | Debian | Ubuntu |
| ARCH | armhf, arm64, i386, amd64 | armhf, arm64, i386, amd64 | armhf, arm64, i386, amd64 |
| RELEASE | e.g. **daedalus**, excalibur, ceres | e.g bookworm, trixie, sid | e.g. focal, jammy, noble |
To build:
```bash
docker build -t devuan/sd-images -f Dockerfile.devuan https://github.com/watchful-0wl/sd-card-images.git#add_devuan
mkdir -p /tmp/sd-images
docker run --rm \
-v /tmp/sd-images:/artifacts \
devuan/sd-images \
build-debian ${DISTRIBUTION} ${ARCH} ${RELEASE}
```
The image will end up in /tmp/sd-images on the host as `${DISTRIBUTION}-${ARCH}-${RELEASE}-${PASSWORD}.bin`.
## Examples
### Example boot image
#### To build a boot image for Raspberry Pi 3 B
```bash
docker build -t devuan/sd-images -f Dockerfile.devuan https://github.com/watchful-0wl/sd-card-images.git#add_devuan
mkdir -p /tmp/sd-images
docker run --rm \
-v /tmp/sd-images:/artifacts \
devuan/sd-images \
build-boot raspberrypi_3b \
bcm2837 \
rpi_3_defconfig \
aarch64-linux-gnu
```
The image will end up in /tmp/sd-images on the host.
#### To build a boot image for Pine64 Rockpro64
```bash
docker build -t devuan/sd-images -f Dockerfile.devuan https://github.com/watchful-0wl/sd-card-images.git#add_devuan
mkdir -p /tmp/sd-images
docker run --rm \
-v /tmp/sd-images:/artifacts \
devuan/sd-images \
build-boot ROCKPro64 \
rk3399 \
rockpro64-rk3399_defconfig \
aarch64-linux-gnu
```
The image will end up in /tmp/sd-images on the host.
#### To build a boot image for Sinovoip Banana Pi M2 Zero
```bash
docker build -t devuan/sd-images -f Dockerfile.devuan https://github.com/watchful-0wl/sd-card-images.git#add_devuan
mkdir -p /tmp/sd-images
docker run --rm \
-v /tmp/sd-images:/artifacts \
devuan/sd-images \
build-boot banana_pi_m2_zero \
allwinner-h2+ \
bananapi_m2_zero_defconfig \
arm-linux-gnueabihf
```
The image will end up in /tmp/sd-images on the host.
### Example root filesystem image
#### To build a Devuan ext4 root filesystem image for arm64
```bash
docker build -t devuan/sd-images -f Dockerfile.devuan https://github.com/watchful-0wl/sd-card-images.git#add_devuan
mkdir -p /tmp/sd-images
docker run --rm \
-v /tmp/sd-images:/artifacts \
devuan/sd-images \
build-debian devuan arm64 daedalus
```
The image will end up in /tmp/sd-images on the host.
#### To build a Devuan ext4 root filesystem image for armhf
```bash
docker build -t devuan/sd-images -f Dockerfile.devuan https://github.com/watchful-0wl/sd-card-images.git#add_devuan
mkdir -p /tmp/sd-images
docker run --rm \
-v /tmp/sd-images:/artifacts \
devuan/sd-images \
build-debian devuan armhf daedalus
```
The image will end up in /tmp/sd-images on the host.

View File

@ -9,6 +9,16 @@ debian,sid,armhf,"Debian unstable (""sid"")",False
debian,sid,arm64,"Debian unstable (""sid"")",False
debian,experimental,armhf,"Debian experimental (""rc-buggy"")",True
debian,experimental,arm64,"Debian experimental (""rc-buggy"")",True
devuan,ceres,armhf,"Devuan unstable/1.0.0 (""ceres"")",False
devuan,ceres,arm64,"Devuan unstable/1.0.0 (""ceres"")",False
devuan,beowulf,armhf,"Devuan oldoldstable/3.0 (""beowulf"")",False
devuan,beowulf,arm64,"Devuan oldoldstable/3.0 (""beowulf"")",False
devuan,chimaera,armhf,"Devuan oldstable/4.0 (""chimaera"")",False
devuan,chimaera,arm64,"Devuan oldstable/4.0 (""chimaera"")",False
devuan,daedalus,armhf,"Devuan stable/5.0 (""daedalus"")",False
devuan,daedalus,arm64,"Devuan stable/5.0 (""daedalus"")",False
devuan,excalibur,armhf,"Devuan testing/6.0 (""excalibur"")",False
devuan,excalibur,arm64,"Devuan testing/6.0 (""excalibur"")",False
ubuntu,focal,armhf,"Ubuntu 20.04 LTS (""focal"")",False
ubuntu,focal,arm64,"Ubuntu 20.04 LTS (""focal"")",False
ubuntu,jammy,armhf,"Ubuntu 22.04 LTS (""jammy"")",False
@ -17,4 +27,5 @@ ubuntu,mantic,armhf,"Ubuntu 23.10 (""mantic"")",False
ubuntu,mantic,arm64,"Ubuntu 23.10 (""mantic"")",False
ubuntu,noble,armhf,"Ubuntu 24.04 LTS (""noble"")",False
ubuntu,noble,arm64,"Ubuntu 24.04 LTS (""noble"")",False
ubuntu,oracular,armhf,"Ubuntu 24.10 (""oracular"")",True
ubuntu,oracular,arm64,"Ubuntu 24.10 (""oracular"")",True

1 OS Dist Arch Name Exp
9 debian sid arm64 Debian unstable ("sid") False
10 debian experimental armhf Debian experimental ("rc-buggy") True
11 debian experimental arm64 Debian experimental ("rc-buggy") True
12 devuan ceres armhf Devuan unstable/1.0.0 ("ceres") False
13 devuan ceres arm64 Devuan unstable/1.0.0 ("ceres") False
14 devuan beowulf armhf Devuan oldoldstable/3.0 ("beowulf") False
15 devuan beowulf arm64 Devuan oldoldstable/3.0 ("beowulf") False
16 devuan chimaera armhf Devuan oldstable/4.0 ("chimaera") False
17 devuan chimaera arm64 Devuan oldstable/4.0 ("chimaera") False
18 devuan daedalus armhf Devuan stable/5.0 ("daedalus") False
19 devuan daedalus arm64 Devuan stable/5.0 ("daedalus") False
20 devuan excalibur armhf Devuan testing/6.0 ("excalibur") False
21 devuan excalibur arm64 Devuan testing/6.0 ("excalibur") False
22 ubuntu focal armhf Ubuntu 20.04 LTS ("focal") False
23 ubuntu focal arm64 Ubuntu 20.04 LTS ("focal") False
24 ubuntu jammy armhf Ubuntu 22.04 LTS ("jammy") False
27 ubuntu mantic arm64 Ubuntu 23.10 ("mantic") False
28 ubuntu noble armhf Ubuntu 24.04 LTS ("noble") False
29 ubuntu noble arm64 Ubuntu 24.04 LTS ("noble") False
30 ubuntu oracular armhf Ubuntu 24.10 ("oracular") True
31 ubuntu oracular arm64 Ubuntu 24.10 ("oracular") True

View File

@ -9,6 +9,16 @@ debian,sid,i386,"Debian unstable (""sid"")",False
debian,sid,amd64,"Debian unstable (""sid"")",False
debian,experimental,i386,"Debian experimental (""rc-buggy"")",True
debian,experimental,amd64,"Debian experimental (""rc-buggy"")",True
devuan,ceres,i386,"Devuan unstable/1.0.0 (""ceres"")",False
devuan,ceres,amd64,"Devuan unstable/1.0.0 (""ceres"")",False
devuan,beowulf,i386,"Devuan oldoldstable/3.0 (""beowulf"")",False
devuan,beowulf,amd64,"Devuan oldoldstable/3.0 (""beowulf"")",False
devuan,chimaera,i386,"Devuan oldstable/4.0 (""chimaera"")",False
devuan,chimaera,amd64,"Devuan oldstable/4.0 (""chimaera"")",False
devuan,daedalus,i386,"Devuan stable/5.0 (""daedalus"")",False
devuan,daedalus,amd64,"Devuan stable/5.0 (""daedalus"")",False
devuan,excalibur,i386,"Devuan testing/6.0 (""excalibur"")",False
devuan,excalibur,amd64,"Devuan testing/6.0 (""excalibur"")",False
ubuntu,focal,i386,"Ubuntu 20.04 LTS (""focal"")",False
ubuntu,focal,amd64,"Ubuntu 20.04 LTS (""focal"")",False
ubuntu,jammy,i386,"Ubuntu 22.04 LTS (""jammy"")",False

1 OS Dist Arch Name Exp
9 debian sid amd64 Debian unstable ("sid") False
10 debian experimental i386 Debian experimental ("rc-buggy") True
11 debian experimental amd64 Debian experimental ("rc-buggy") True
12 devuan ceres i386 Devuan unstable/1.0.0 ("ceres") False
13 devuan ceres amd64 Devuan unstable/1.0.0 ("ceres") False
14 devuan beowulf i386 Devuan oldoldstable/3.0 ("beowulf") False
15 devuan beowulf amd64 Devuan oldoldstable/3.0 ("beowulf") False
16 devuan chimaera i386 Devuan oldstable/4.0 ("chimaera") False
17 devuan chimaera amd64 Devuan oldstable/4.0 ("chimaera") False
18 devuan daedalus i386 Devuan stable/5.0 ("daedalus") False
19 devuan daedalus amd64 Devuan stable/5.0 ("daedalus") False
20 devuan excalibur i386 Devuan testing/6.0 ("excalibur") False
21 devuan excalibur amd64 Devuan testing/6.0 ("excalibur") False
22 ubuntu focal i386 Ubuntu 20.04 LTS ("focal") False
23 ubuntu focal amd64 Ubuntu 20.04 LTS ("focal") False
24 ubuntu jammy i386 Ubuntu 22.04 LTS ("jammy") False

View File

@ -19,14 +19,28 @@ class Release:
def __init__(self, fileobj):
params = {}
for line in fileobj:
line = line.decode("utf-8")
if line.startswith(" ") or ": " not in line:
continue
line = line.decode('utf-8').strip()
# Header of "Release" finishes at:
# "MD5Sum:" in Debian/Ubuntu
# "SHA256:" in Devuan
if line == "MD5Sum:" or line == "SHA256:":
break
k, v = line.strip().split(": ", 1)
k, v = line.split(": ", 1)
params[k] = v
self.label = params.get("Label")
# In Release files,
# e.g. https://ftp.debian.org/debian/dists/stable/Release
# "Origin" is Debian/Ubuntu/Devuan as expected.
# "Origin" = "Label" for Debian and Ubuntu, not always for Devuan.
# "Label" is "Debian"/"Ubuntu" for Debian/Ubuntu.
# "Label" is "Devuan" or "Master" for Devuan.
# "Label" of "Master" has no equivalent in Debian/Ubuntu.
#
# Where this program uses "label" it really wants "origin".
self.origin = params.get("Origin")
self.label = self.origin
self.suite = params.get("Suite")
self.version = params.get("Version")
self.codename = params.get("Codename")
@ -84,9 +98,10 @@ class Release:
return date.today() - release_date
def is_relevant(self):
if self.label not in ("Debian", "Ubuntu", ):
if self.label not in ("Debian", "Ubuntu", "Devuan", ):
return False
if self.label == "Debian" or self.label == "Ubuntu":
bl1 = ("oldoldstable", "devel", )
if self.suite in bl1:
return False
@ -95,6 +110,18 @@ class Release:
if any(self.suite.endswith(suffix) for suffix in bl2):
return False
if self.label == "Devuan":
# "oldoldstable" is maintained in Devuan.
# These are no longer maintained.
bl_ = ("jessie", "ascii", )
if self.suite in bl_:
return False
# For fine-grained control:
bl_ = ("-backports", "-security", "-proposed-updates", )
if any(self.suite.endswith(suffix) for suffix in bl_):
return False
if self.label == "Ubuntu":
if self.is_lts():
return self.age() < 5 * timedelta(days=365)
@ -108,10 +135,19 @@ class Release:
return True
if self.label == "Ubuntu" and self.age() < timedelta(days=0):
return True
if self.label == "Devuan" and self.suite == "experimental":
return True
return False
"""
# Note: get_releases(url) is deprecated because it can not work with Devuan.
# Instead, use get_dist_releases(url).
#
# get_releases(url) requires the file ls-lR.gz to be present.
# This is not available in Devuan.
#
def get_releases(url):
dirlinepattern = re.compile(
r"\.(/dists/[\w\-]+):"
@ -172,6 +208,65 @@ def get_releases(url):
yield Release(u)
except urllib.error.URLError as e:
logger.warning("Failed to download %s: %s", relurl, e)
"""
def get_dist_releases(url):
from lxml import html
# Open the web page listurl and use an xpath to extract the dist names.
listurl = url + "/dists/"
try:
tree = html.fromstring(urllib.request.urlopen(listurl).read())
logger.debug("Downloaded %s", listurl)
except urllib.error.URLError as e:
logger.warning("Failed to download %s: %s", listurl, e)
else:
# Extract dist names from the web links.
"""
Finds <a href="{debiandir}"> in the web page.
Using Xpath 1.0:
matches: buster/, daedalus/, noble/, oldstable, stable/, unstable/
does not match: ../, /debian/, daedalus-updates/, 6.0/
The chosen xpath:
dist_path = "//a[contains(@href,'/') \
and not(starts-with(@href,'/')) \
and not(contains(@href,'-')) \
and not(contains(@href,'.')) \
]/@href"
will select only hrefs which are:
not, e.g., /debian/ not(starts-with(@href,'/'))
directories contains(@href,'/')
codenames not(contains(@href,'-'))
not numbers or ../ not(contains(@href,'.'))
This excludes all "-updates", "-backports", "-security", "-proposed", etc.
"""
dist_path = "//a[contains(@href,'/') \
and not(starts-with(@href,'/')) \
and not(contains(@href,'-')) \
and not(contains(@href,'.')) \
]/@href"
dist_names = tree.xpath(dist_path)
for debiandir in dist_names:
relurl = listurl + debiandir + "Release"
try:
with urllib.request.urlopen(relurl) as u:
logger.debug("Downloaded %s", relurl)
yield Release(u)
except urllib.error.URLError as e:
logger.warning("Failed to download %s: %s", relurl, e)
def write_csv(filename, releases, archs):
@ -181,6 +276,7 @@ def write_csv(filename, releases, archs):
for r in releases:
if not r.is_relevant():
logger.debug("Discarding as not relevant: %s ", repr(r))
continue
for arch in archs:
@ -203,11 +299,13 @@ def write_csv(filename, releases, archs):
if __name__ == "__main__":
logger.info("Downloading releases...")
debianreleases = set(get_releases("http://ftp.debian.org/debian"))
debianreleases = set(get_dist_releases("http://ftp.debian.org/debian"))
assert len(debianreleases) > 0
ubuntureleases = set(get_releases("http://ftp.ubuntu.com/ubuntu"))
ubuntureleases = set(get_dist_releases("http://ftp.ubuntu.com/ubuntu"))
assert len(ubuntureleases) > 0
releases = list(sorted(debianreleases | ubuntureleases))
devuanreleases = set(get_dist_releases("http://deb.devuan.org/merged"))
assert len(devuanreleases) > 0
releases = list(sorted(debianreleases | ubuntureleases | devuanreleases))
assert len(releases) > 0
logger.info("Found %d releases", len(releases))

6
rebase_test.txt Normal file
View File

@ -0,0 +1,6 @@
line 1
line 2
line 3
line 4
line 5
line 6

View File

@ -44,6 +44,31 @@ ubuntu-armhf|ubuntu-arm64)
KERNEL_URL=http://packages.ubuntu.com/"${DIST}"/"${KERNEL}"
SCRIPT=/usr/share/debootstrap/scripts/gutsy
;;
devuan-armhf)
KERNEL=linux-image-armmp
URL=http://deb.devuan.org/merged
# 2024-05-01 pkginfo.devuan.org does not have info for armhf.
KERNEL_URL=https://pkginfo.devuan.org/cgi-bin/policy-query.html?c=package&q=${KERNEL}
SCRIPT=/usr/share/debootstrap/scripts/ceres
;;
devuan-arm64)
KERNEL=linux-image-arm64
URL=http://deb.devuan.org/merged
KERNEL_URL=https://pkginfo.devuan.org/cgi-bin/policy-query.html?c=package&q=${KERNEL}
SCRIPT=/usr/share/debootstrap/scripts/ceres
;;
devuan-i386)
KERNEL=linux-image-686
URL=http://deb.devuan.org/merged
KERNEL_URL=https://pkginfo.devuan.org/cgi-bin/policy-query.html?c=package&q=${KERNEL}
SCRIPT=/usr/share/debootstrap/scripts/ceres
;;
devuan-amd64)
KERNEL=linux-image-amd64
URL=http://deb.devuan.org/merged
KERNEL_URL=https://pkginfo.devuan.org/cgi-bin/policy-query.html?c=package&q=${KERNEL}
SCRIPT=/usr/share/debootstrap/scripts/ceres
;;
*)
echo "Can't decide kernel package for \"${ARCH}\""
exit 1
@ -67,6 +92,8 @@ trap 'rm -rf "${TMP}"' EXIT INT TERM
cd "${TMP}"
# Build a Debian root filesystem (first stage)
case ${OS} in
debian | ubuntu)
debootstrap \
--arch="${ARCH}" \
--verbose \
@ -84,6 +111,61 @@ nano \
debian \
"${URL}" \
"${SCRIPT}"
;;
devuan)
# Need Devuan's keys and Devuan's debootstrap.
case ${DIST} in
ceres | beowulf | chimaera | daedalus)
# https://www.devuan.org/os/keyring
# Ceres, Beowulf, Chimaera and Daedalus
RELEASE_KEY="94532124541922FB"
;;
excalibur)
RELEASE_KEY="B3982868D104092C"
;;
freia)
RELEASE_KEY="55C470D57732684B"
;;
*)
echo "Can't decide release key for \"${DIST}\""
exit 1
;;
esac
# Use Ubuntu's gpg to get Devuan's signing key.
apt-get update && apt-get install -y gpg
# Add Devuan's signing key.
echo "Adding Devuan ${DIST} signing key (https://www.devuan.org/os/keyring):" ${RELEASE_KEY}
gpg --keyserver keyring.devuan.org --recv-keys ${RELEASE_KEY} && \
gpg --export ${RELEASE_KEY} >/etc/apt/trusted.gpg.d/devuan_key.gpg
# Get Devuan's debootstrap.
echo "deb http://deb.devuan.org/merged ${DIST} main" > /etc/apt/sources.list.d/devuan.list
apt-get update && apt-get --assume-yes \
--no-install-recommends \
install --force-yes -t ${DIST} debootstrap
debootstrap \
--arch="${ARCH}" \
--verbose \
--variant=minbase \
--foreign \
--include=\
netbase,\
net-tools,\
sysvinit,\
u-boot-tools,\
initramfs-tools,\
openssh-server,\
nano,\
vim-tiny \
"${TARGET}" \
debian \
"${URL}" \
"${SCRIPT}"
;;
esac
# Randomly generated root password
PASSWORD="${PASSWORD_OVERRIDE:-$(pwgen -B -A 6 1)}"
@ -132,6 +214,30 @@ deb http://ports.ubuntu.com/ubuntu-ports ${DIST}-updates main universe
deb-src http://ports.ubuntu.com/ubuntu-ports ${DIST}-updates main universe
deb http://ports.ubuntu.com/ubuntu-ports ${DIST}-security main universe
deb-src http://ports.ubuntu.com/ubuntu-ports ${DIST}-security main universe
EOF
;;
devuan-*-excalibur | devuan-*-testing)
# https://pkginfo.devuan.org/sources.list.txt
tee debian/tmp/sources.list <<-EOF
deb http://deb.devuan.org/merged ${DIST} main
deb-src http://deb.devuan.org/merged ${DIST} main
EOF
;;
devuan-*-ceres | devuan-*-unstable)
# https://pkginfo.devuan.org/sources.list.txt
tee debian/tmp/sources.list <<-EOF
deb http://deb.devuan.org/merged ${DIST} main
deb-src http://deb.devuan.org/merged ${DIST} main
EOF
;;
devuan-*)
tee debian/tmp/sources.list <<-EOF
deb http://deb.devuan.org/merged ${DIST} main
deb-src http://deb.devuan.org/merged ${DIST} main
deb http://deb.devuan.org/merged ${DIST}-updates main
deb-src http://deb.devuan.org/merged ${DIST}-updates main
deb http://deb.devuan.org/merged ${DIST}-security main
deb-src http://deb.devuan.org/merged ${DIST}-security main
EOF
;;
esac
@ -156,6 +262,9 @@ cp -rv --preserve=mode ../2nd-stage-files/pre-2nd-stage-files-${ARCH}/* debian
cp -v /usr/bin/qemu-*-static debian/usr/bin || :
# Build a Debian root filesystem (second stage)
case "${OS}" in
debian | ubuntu)
# Build a Debian root filesystem (second stage)
chroot debian /bin/sh -ex <<-EOF
/debootstrap/debootstrap --second-stage
/bin/mv /tmp/sources.list /etc/apt/sources.list
@ -176,6 +285,28 @@ echo "kernel-url,${KERNEL_URL}\n" >> /tmp/versions.csv
/bin/echo "root:${PASSWORD}" | /usr/sbin/chpasswd
/bin/sed -i "s/#*\s*PermitRootLogin .*/PermitRootLogin yes/" /etc/ssh/sshd_config
EOF
;;
devuan)
# Build a Devuan root filesystem (second stage)
chroot debian /bin/sh -ex <<-EOF
/debootstrap/debootstrap --second-stage
/bin/mv /tmp/sources.list /etc/apt/sources.list
# /usr/bin/apt-key add /etc/apt/trusted.gpg.d/devuan_key.gpg
/usr/bin/apt-get update
/usr/bin/apt-get -y upgrade
/usr/bin/apt-get -y --no-install-recommends "${KERNELSUITE}" install "${KERNEL}"
/usr/bin/apt-get -y install connman || :
/usr/bin/apt-get -y install openntpd || :
/usr/bin/apt-get clean
/bin/rm -rf /var/lib/apt/lists/*
echo "kernel-url,${KERNEL_URL}\n" >> /tmp/versions.csv
/usr/bin/dpkg-query --showformat='kernel,\${Version}\n' --show "${KERNEL}" > /tmp/versions.csv
/bin/rm -f /var/log/*.log
/bin/echo "root:${PASSWORD}" | /usr/sbin/chpasswd
/bin/sed -i "s/#*\s*PermitRootLogin .*/PermitRootLogin yes/" /etc/ssh/sshd_config
EOF
;;
esac
# Remove ARM emulation stuff again
rm -v debian/usr/bin/qemu-*-static || :
@ -186,7 +317,14 @@ cp -rv --preserve=mode ../2nd-stage-files/post-2nd-stage-files/* debian
echo "${OS}" > debian/etc/hostname
# Set resolv.conf
case "${OS}" in
debian | ubuntu)
ln -sf /run/systemd/resolve/stub-resolv.conf debian/etc/resolv.conf
;;
devuan)
ln -sf /run/connman/resolv.conf debian/etc/resolv.conf
;;
esac
# List all files
find debian ! -type d -printf "/%P\n" | sort > files.txt