diff --git a/README.md b/README.md index 8b7f875af5..f867ca20b1 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,8 @@ The following environment variables are supported: public key authentication. Note that if SSH is not enabled this will take effect when SSH becomes enabled. + * `SSH_PORT` (Default: `22`) + * `STAGE_LIST` (Default: `stage*`) 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. diff --git a/build.sh b/build.sh index 6f720b1f50..cf3196c81b 100755 --- a/build.sh +++ b/build.sh @@ -172,6 +172,7 @@ export WPA_PASSWORD export WPA_COUNTRY export ENABLE_SSH="${ENABLE_SSH:-0}" export PUBKEY_ONLY_SSH="${PUBKEY_ONLY_SSH:-0}" +export SSH_PORT export LOCALE_DEFAULT="${LOCALE_DEFAULT:-en_GB.UTF-8}" diff --git a/stage2/01-sys-tweaks/01-run.sh b/stage2/01-sys-tweaks/01-run.sh index c1836f9ca6..4eb6eaf76c 100755 --- a/stage2/01-sys-tweaks/01-run.sh +++ b/stage2/01-sys-tweaks/01-run.sh @@ -23,6 +23,10 @@ if [ "${PUBKEY_ONLY_SSH}" = "1" ]; then s/^#?[[:blank:]]*PasswordAuthentication[[:blank:]]*yes[[:blank:]]*$/PasswordAuthentication no/' "${ROOTFS_DIR}"/etc/ssh/sshd_config fi +if [ -n "${SSH_PORT}" ]; then + sed -i "s/#Port 22/Port ${SSH_PORT}/" "${ROOTFS_DIR}/etc/ssh/sshd_config" +fi + on_chroot << EOF systemctl disable hwclock.sh systemctl disable nfs-common