added option disable default boot counter reset
This commit is contained in:
		
							
								
								
									
										33
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								README.md
									
									
									
									
									
								
							@@ -55,22 +55,23 @@ chroot_exec rc-update add example_daemon default
 | 
				
			|||||||
The following variables can be used to modify the base behaviour of the image 
 | 
					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_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 |
 | 
				
			||||||
| IMG_NAME                 | sdcard                               | Base name of created image file                                                                   |
 | 
					| IMG_NAME                    | sdcard                               | Base name of created image file                                                                   |
 | 
				
			||||||
| INPUT_PATH               | /input                               | Input directory inside container                                                                  |
 | 
					| INPUT_PATH                  | /input                               | Input directory inside container                                                                  |
 | 
				
			||||||
| OUTPUT_PATH              | /output                              | Output directory inside container                                                                 |
 | 
					| OUTPUT_PATH                 | /output                              | Output directory inside container                                                                 |
 | 
				
			||||||
| SIZE_BOOT                | 100M                                 | Size of boot partition                                                                            |
 | 
					| SIZE_BOOT                   | 100M                                 | Size of boot partition                                                                            |
 | 
				
			||||||
| SIZE_DATA                | 20M                                  | Initial Size of data partition                                                                    |
 | 
					| SIZE_DATA                   | 20M                                  | Initial Size of data partition                                                                    |
 | 
				
			||||||
| SIZE_ROOT_FS             | 200M                                 | Size of root file system                                                                          |
 | 
					| SIZE_ROOT_FS                | 200M                                 | Size of root file system                                                                          |
 | 
				
			||||||
| SIZE_ROOT_PART           | 500M                                 | Size of root partition                                                                            |
 | 
					| SIZE_ROOT_PART              | 500M                                 | Size of root partition                                                                            |
 | 
				
			||||||
 | 
					| UBOOT_COUNTER_RESET_ENABLED | true                                 | True to enable simple boot counter reset service                                                  |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Update running system
 | 
					### Update running system
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,7 @@ set -e
 | 
				
			|||||||
: ${DEFAULT_HOSTNAME:="alpine"}
 | 
					: ${DEFAULT_HOSTNAME:="alpine"}
 | 
				
			||||||
: ${DEFAULT_ROOT_PASSWORD:="alpine"}
 | 
					: ${DEFAULT_ROOT_PASSWORD:="alpine"}
 | 
				
			||||||
: ${DEFAULT_DROPBEAR_ENABLED:="true"}
 | 
					: ${DEFAULT_DROPBEAR_ENABLED:="true"}
 | 
				
			||||||
 | 
					: ${UBOOT_COUNTER_RESET_ENABLED:="true"}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
: ${SIZE_BOOT:="100M"}
 | 
					: ${SIZE_BOOT:="100M"}
 | 
				
			||||||
: ${SIZE_ROOT_FS:="200M"}
 | 
					: ${SIZE_ROOT_FS:="200M"}
 | 
				
			||||||
@@ -150,9 +151,9 @@ chroot_exec rc-update add ntpd default
 | 
				
			|||||||
# uboot tools
 | 
					# uboot tools
 | 
				
			||||||
cp /uboot_tool ${ROOTFS_PATH}/sbin/uboot_tool
 | 
					cp /uboot_tool ${ROOTFS_PATH}/sbin/uboot_tool
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# TODO REMOVE THIS
 | 
					if [ "$UBOOT_COUNTER_RESET_ENABLED" = "true" ]; then
 | 
				
			||||||
# mark system as booted (should be moved to application)
 | 
					  # mark system as booted (should be moved to application)
 | 
				
			||||||
cat >${ROOTFS_PATH}/etc/local.d/99-uboot.start <<EOF
 | 
					  cat >${ROOTFS_PATH}/etc/local.d/99-uboot.start <<EOF
 | 
				
			||||||
#!/bin/sh
 | 
					#!/bin/sh
 | 
				
			||||||
mount -o remount,rw /uboot
 | 
					mount -o remount,rw /uboot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -161,7 +162,8 @@ mount -o remount,rw /uboot
 | 
				
			|||||||
sync
 | 
					sync
 | 
				
			||||||
mount -o remount,ro /uboot
 | 
					mount -o remount,ro /uboot
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
chmod +x ${ROOTFS_PATH}/etc/local.d/99-uboot.start
 | 
					  chmod +x ${ROOTFS_PATH}/etc/local.d/99-uboot.start
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# copy helper scripts
 | 
					# copy helper scripts
 | 
				
			||||||
cp ${RES_PATH}/scripts/* ${ROOTFS_PATH}/sbin/
 | 
					cp ${RES_PATH}/scripts/* ${ROOTFS_PATH}/sbin/
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user