From 00bda84713a52c077a89cd44e24f765cfc2ecd5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=B6hmke?= Date: Sun, 15 Dec 2019 19:26:41 +0100 Subject: [PATCH] added option to enable/disable SSH server by default --- README.md | 31 ++++++++++++++++--------------- resources/build.sh | 6 +++++- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index ec6f426..0b8c428 100644 --- a/README.md +++ b/README.md @@ -55,21 +55,22 @@ chroot_exec rc-update add example_daemon default The following variables can be used to modify the base behaviour of the image builder. -| Variable | Default Value | Description | -| --------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------- | -| ALPINE_BRANCH | 3.10 | [Alpine Branch](https://wiki.alpinelinux.org/wiki/Alpine_Linux:Releases) to use for image | -| ALPINE_MIRROR | http://dl-cdn.alpinelinux.org/alpine | Mirror used for package download | -| CUSTOM_IMAGE_SCRIPT | image.sh | Name of script for image customizations (relative to input dir) | -| DEFAULT_HOSTNAME | alpine | Default hostname | -| DEFAULT_ROOT_PASSWORD | alpine | Default password for root user | -| DEFAULT_TIMEZONE | Etc/UTC | Default [Timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to use for image | -| IMG_NAME | sdcard | Base name of created image file | -| INPUT_PATH | /input | Input directory inside container | -| OUTPUT_PATH | /output | Output directory inside container | -| SIZE_BOOT | 100M | Size of boot partition | -| SIZE_DATA | 20M | Initial Size of data partition | -| SIZE_ROOT_FS | 200M | Size of root file system | -| SIZE_ROOT_PART | 500M | Size of root partition | +| Variable | Default Value | Description | +| ------------------------ | ------------------------------------ | ------------------------------------------------------------------------------------------------- | +| ALPINE_BRANCH | 3.10 | [Alpine Branch](https://wiki.alpinelinux.org/wiki/Alpine_Linux:Releases) to use for image | +| ALPINE_MIRROR | http://dl-cdn.alpinelinux.org/alpine | Mirror used for package download | +| CUSTOM_IMAGE_SCRIPT | image.sh | Name of script for image customizations (relative to input dir) | +| DEFAULT_DROPBEAR_ENABLED | true | True to enable SSH server by default | +| DEFAULT_HOSTNAME | alpine | Default hostname | +| DEFAULT_ROOT_PASSWORD | alpine | Default password for root user | +| DEFAULT_TIMEZONE | Etc/UTC | Default [Timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to use for image | +| IMG_NAME | sdcard | Base name of created image file | +| INPUT_PATH | /input | Input directory inside container | +| OUTPUT_PATH | /output | Output directory inside container | +| SIZE_BOOT | 100M | Size of boot partition | +| SIZE_DATA | 20M | Initial Size of data partition | +| SIZE_ROOT_FS | 200M | Size of root file system | +| SIZE_ROOT_PART | 500M | Size of root partition | ### Update running system diff --git a/resources/build.sh b/resources/build.sh index 902c0a2..9d5eaf1 100755 --- a/resources/build.sh +++ b/resources/build.sh @@ -10,6 +10,7 @@ set -e : ${DEFAULT_TIMEZONE:="Etc/UTC"} : ${DEFAULT_HOSTNAME:="alpine"} : ${DEFAULT_ROOT_PASSWORD:="alpine"} +: ${DEFAULT_DROPBEAR_ENABLED:="true"} : ${SIZE_BOOT:="100M"} : ${SIZE_ROOT_FS:="200M"} @@ -166,7 +167,6 @@ chmod +x ${ROOTFS_PATH}/etc/local.d/99-uboot.start cp ${RES_PATH}/scripts/* ${ROOTFS_PATH}/sbin/ -# TODO configurable # dropbear chroot_exec apk add dropbear chroot_exec rc-update add dropbear @@ -175,6 +175,10 @@ ln -s /data/etc/dropbear/ ${ROOTFS_PATH}/etc/dropbear mv ${ROOTFS_PATH}/etc/conf.d/dropbear ${ROOTFS_PATH}/etc/conf.d/dropbear_org ln -s /data/etc/dropbear/dropbear.conf ${ROOTFS_PATH}/etc/conf.d/dropbear +if [ "$DEFAULT_DROPBEAR_ENABLED" = "true" ]; then + echo 'DROPBEAR_OPTS="-p 127.0.0.1:22"' > ${ROOTFS_PATH}/etc/conf.d/dropbear_org +fi + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # echo ">> Move persistent data to /data"