Skip to content

Commit bd2cf0e

Browse files
committed
Merge branch 'master' into arm64
2 parents da6dde2 + c3083ec commit bd2cf0e

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

README.md

+15-5
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ Getting started is as simple as cloning this repository on your build machine. Y
2727
can do so with:
2828

2929
```bash
30-
git clone --depth 1 https://github.com/RPI-Distro/pi-gen.git
30+
git clone https://github.com/RPI-Distro/pi-gen.git
3131
```
3232

33-
Using `--depth 1` with `git clone` will create a shallow clone, only containing
33+
`--depth 1` can be added afer `git clone` to create a shallow clone, only containing
3434
the latest revision of the repository. Do not do this on your development machine.
3535

3636
Also, be careful to clone the repository to a base path **NOT** containing spaces.
@@ -80,8 +80,11 @@ The following environment variables are supported:
8080

8181
* `RELEASE` (Default: bullseye)
8282

83-
The release version to build images against. Valid values are jessie, stretch,
84-
buster, bullseye, and testing.
83+
The release version to build images against. Valid values are any supported
84+
Debian release. However, since different releases will have different sets of
85+
packages available, you'll need to either modify your stages accordingly, or
86+
checkout the appropriate branch. For example, if you'd like to build a
87+
`buster` image, you should do so from the `buster` branch.
8588

8689
* `APT_PROXY` (Default: unset)
8790

@@ -212,6 +215,13 @@ The following environment variables are supported:
212215
public key authentication. Note that if SSH is not enabled this will take
213216
effect when SSH becomes enabled.
214217

218+
* `SETFCAP` (Default: unset)
219+
220+
* Setting to `1` will prevent pi-gen from dropping the "capabilities"
221+
feature. Generating the root filesystem with capabilities enabled and running
222+
it from a filesystem that does not support capabilities (like NFS) can cause
223+
issues. Only enable this if you understand what it is.
224+
215225
* `STAGE_LIST` (Default: `stage*`)
216226

217227
If set, then instead of working through the numeric stages in order, this list will be followed. For example setting to `"stage0 stage1 mystage stage2"` will run the contents of `mystage` before stage2. Note that quotes are needed around the list. An absolute or relative path can be given for stages outside the pi-gen directory.
@@ -489,7 +499,7 @@ A 64 bit image can be generated from the `arm64` branch in this repository. Just
489499
replace the command from [this section](#getting-started-with-building-your-images)
490500
by the one below, and follow the rest of the documentation:
491501
```bash
492-
git clone --depth 1 --branch arm64 https://github.com/RPI-Distro/pi-gen.git
502+
git clone --branch arm64 https://github.com/RPI-Distro/pi-gen.git
493503
```
494504

495505
If you want to generate a 64 bits image from a Raspberry Pi running a 32 bits

build.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export TARGET_HOSTNAME=${TARGET_HOSTNAME:-raspberrypi}
226226
export FIRST_USER_NAME=${FIRST_USER_NAME:-pi}
227227
export FIRST_USER_PASS
228228
export DISABLE_FIRST_BOOT_USER_RENAME=${DISABLE_FIRST_BOOT_USER_RENAME:-0}
229-
export RELEASE=${RELEASE:-bullseye}
229+
export RELEASE=${RELEASE:-bullseye} # Don't forget to update stage0/prerun.sh
230230
export WPA_ESSID
231231
export WPA_PASSWORD
232232
export WPA_COUNTRY
@@ -283,6 +283,10 @@ fi
283283

284284
export NO_PRERUN_QCOW2="${NO_PRERUN_QCOW2:-1}"
285285

286+
if [ "$SETFCAP" != "1" ]; then
287+
export CAPSH_ARG="--drop=cap_setfcap"
288+
fi
289+
286290
dependencies_check "${BASE_DIR}/depends"
287291

288292
#check username is valid

scripts/common

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ bootstrap(){
1818
BOOTSTRAP_ARGS+=("$@")
1919
printf -v BOOTSTRAP_STR '%q ' "${BOOTSTRAP_ARGS[@]}"
2020

21-
capsh --drop=cap_setfcap -- -c "'${BOOTSTRAP_CMD}' $BOOTSTRAP_STR" || true
21+
capsh $CAPSH_ARG -- -c "'${BOOTSTRAP_CMD}' $BOOTSTRAP_STR" || true
2222

2323
if [ -d "$2/debootstrap" ] && ! rmdir "$2/debootstrap"; then
2424
cp "$2/debootstrap/debootstrap.log" "${STAGE_WORK_DIR}"
@@ -91,7 +91,7 @@ on_chroot() {
9191
mount --bind /sys "${ROOTFS_DIR}/sys"
9292
fi
9393

94-
capsh --drop=cap_setfcap "--chroot=${ROOTFS_DIR}/" -- -e "$@"
94+
capsh $CAPSH_ARG "--chroot=${ROOTFS_DIR}/" -- -e "$@"
9595
}
9696
export -f on_chroot
9797

stage0/prerun.sh

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/bin/bash -e
22

3+
if [ "$RELEASE" != "bullseye" ]; then
4+
echo "WARNING: RELEASE does not match the intended option for this branch."
5+
echo " Please check the relevant README.md section."
6+
fi
7+
38
if [ ! -d "${ROOTFS_DIR}" ] || [ "${USE_QCOW2}" = "1" ]; then
49
bootstrap ${RELEASE} "${ROOTFS_DIR}" http://deb.debian.org/debian/
510
fi

0 commit comments

Comments
 (0)