added option to enable/disable SSH server by default
This commit is contained in:
		@@ -56,10 +56,11 @@ 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_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 |
 | 
			
		||||
 
 | 
			
		||||
@@ -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"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user