4
0

added option to enable/disable SSH server by default

This commit is contained in:
Benjamin Böhmke 2019-12-15 19:26:41 +01:00
parent f6edd86471
commit 00bda84713
2 changed files with 21 additions and 16 deletions

View File

@ -56,10 +56,11 @@ The following variables can be used to modify the base behaviour of the image
builder. builder.
| Variable | Default Value | Description | | Variable | Default Value | Description |
| --------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------- | | ------------------------ | ------------------------------------ | ------------------------------------------------------------------------------------------------- |
| ALPINE_BRANCH | 3.10 | [Alpine Branch](https://wiki.alpinelinux.org/wiki/Alpine_Linux:Releases) to use for image | | 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 | | 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) | | 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_HOSTNAME | alpine | Default hostname |
| DEFAULT_ROOT_PASSWORD | alpine | Default password for root user | | 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 | | DEFAULT_TIMEZONE | Etc/UTC | Default [Timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to use for image |

View File

@ -10,6 +10,7 @@ set -e
: ${DEFAULT_TIMEZONE:="Etc/UTC"} : ${DEFAULT_TIMEZONE:="Etc/UTC"}
: ${DEFAULT_HOSTNAME:="alpine"} : ${DEFAULT_HOSTNAME:="alpine"}
: ${DEFAULT_ROOT_PASSWORD:="alpine"} : ${DEFAULT_ROOT_PASSWORD:="alpine"}
: ${DEFAULT_DROPBEAR_ENABLED:="true"}
: ${SIZE_BOOT:="100M"} : ${SIZE_BOOT:="100M"}
: ${SIZE_ROOT_FS:="200M"} : ${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/ cp ${RES_PATH}/scripts/* ${ROOTFS_PATH}/sbin/
# TODO configurable
# dropbear # dropbear
chroot_exec apk add dropbear chroot_exec apk add dropbear
chroot_exec rc-update 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 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 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" echo ">> Move persistent data to /data"