diff --git a/.travis.yml b/.travis.yml index cbaa9cc..7c87fa4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,6 +40,9 @@ env: - DIST=debian TARGET=amd64 VERSION=2.4.0-snapshot - DIST=debian TARGET=armhf VERSION=2.4.0-snapshot - DIST=debian TARGET=arm64 VERSION=2.4.0-snapshot + - DIST=debian TARGET=amd64 VERSION=2.4.0.M3 + - DIST=debian TARGET=armhf VERSION=2.4.0.M3 + - DIST=debian TARGET=arm64 VERSION=2.4.0.M3 - DIST=alpine TARGET=amd64 VERSION=1.8.3 - DIST=alpine TARGET=armhf VERSION=1.8.3 - DIST=alpine TARGET=arm64 VERSION=1.8.3 @@ -58,5 +61,8 @@ env: - DIST=alpine TARGET=amd64 VERSION=2.4.0-snapshot - DIST=alpine TARGET=armhf VERSION=2.4.0-snapshot - DIST=alpine TARGET=arm64 VERSION=2.4.0-snapshot + - DIST=alpine TARGET=amd64 VERSION=2.4.0.M3 + - DIST=alpine TARGET=armhf VERSION=2.4.0.M3 + - DIST=alpine TARGET=arm64 VERSION=2.4.0.M3 matrix: fast_finish: true diff --git a/2.0.0/amd64/alpine/entrypoint.sh b/2.0.0/amd64/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.0.0/amd64/alpine/entrypoint.sh +++ b/2.0.0/amd64/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.0.0/amd64/debian/entrypoint.sh b/2.0.0/amd64/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.0.0/amd64/debian/entrypoint.sh +++ b/2.0.0/amd64/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.0.0/arm64/alpine/entrypoint.sh b/2.0.0/arm64/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.0.0/arm64/alpine/entrypoint.sh +++ b/2.0.0/arm64/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.0.0/arm64/debian/entrypoint.sh b/2.0.0/arm64/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.0.0/arm64/debian/entrypoint.sh +++ b/2.0.0/arm64/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.0.0/armhf/alpine/entrypoint.sh b/2.0.0/armhf/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.0.0/armhf/alpine/entrypoint.sh +++ b/2.0.0/armhf/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.0.0/armhf/debian/entrypoint.sh b/2.0.0/armhf/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.0.0/armhf/debian/entrypoint.sh +++ b/2.0.0/armhf/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.0.0/i386/alpine/entrypoint.sh b/2.0.0/i386/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.0.0/i386/alpine/entrypoint.sh +++ b/2.0.0/i386/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.0.0/i386/debian/entrypoint.sh b/2.0.0/i386/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.0.0/i386/debian/entrypoint.sh +++ b/2.0.0/i386/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.1.0/amd64/alpine/entrypoint.sh b/2.1.0/amd64/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.1.0/amd64/alpine/entrypoint.sh +++ b/2.1.0/amd64/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.1.0/amd64/debian/entrypoint.sh b/2.1.0/amd64/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.1.0/amd64/debian/entrypoint.sh +++ b/2.1.0/amd64/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.1.0/arm64/alpine/entrypoint.sh b/2.1.0/arm64/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.1.0/arm64/alpine/entrypoint.sh +++ b/2.1.0/arm64/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.1.0/arm64/debian/entrypoint.sh b/2.1.0/arm64/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.1.0/arm64/debian/entrypoint.sh +++ b/2.1.0/arm64/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.1.0/armhf/alpine/entrypoint.sh b/2.1.0/armhf/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.1.0/armhf/alpine/entrypoint.sh +++ b/2.1.0/armhf/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.1.0/armhf/debian/entrypoint.sh b/2.1.0/armhf/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.1.0/armhf/debian/entrypoint.sh +++ b/2.1.0/armhf/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.1.0/i386/alpine/entrypoint.sh b/2.1.0/i386/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.1.0/i386/alpine/entrypoint.sh +++ b/2.1.0/i386/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.1.0/i386/debian/entrypoint.sh b/2.1.0/i386/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.1.0/i386/debian/entrypoint.sh +++ b/2.1.0/i386/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.2.0/amd64/alpine/entrypoint.sh b/2.2.0/amd64/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.2.0/amd64/alpine/entrypoint.sh +++ b/2.2.0/amd64/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.2.0/amd64/debian/entrypoint.sh b/2.2.0/amd64/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.2.0/amd64/debian/entrypoint.sh +++ b/2.2.0/amd64/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.2.0/arm64/alpine/entrypoint.sh b/2.2.0/arm64/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.2.0/arm64/alpine/entrypoint.sh +++ b/2.2.0/arm64/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.2.0/arm64/debian/entrypoint.sh b/2.2.0/arm64/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.2.0/arm64/debian/entrypoint.sh +++ b/2.2.0/arm64/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.2.0/armhf/alpine/entrypoint.sh b/2.2.0/armhf/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.2.0/armhf/alpine/entrypoint.sh +++ b/2.2.0/armhf/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.2.0/armhf/debian/entrypoint.sh b/2.2.0/armhf/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.2.0/armhf/debian/entrypoint.sh +++ b/2.2.0/armhf/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.2.0/i386/alpine/entrypoint.sh b/2.2.0/i386/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.2.0/i386/alpine/entrypoint.sh +++ b/2.2.0/i386/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.2.0/i386/debian/entrypoint.sh b/2.2.0/i386/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.2.0/i386/debian/entrypoint.sh +++ b/2.2.0/i386/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.3.0/amd64/alpine/entrypoint.sh b/2.3.0/amd64/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.3.0/amd64/alpine/entrypoint.sh +++ b/2.3.0/amd64/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.3.0/amd64/debian/entrypoint.sh b/2.3.0/amd64/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.3.0/amd64/debian/entrypoint.sh +++ b/2.3.0/amd64/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.3.0/arm64/alpine/entrypoint.sh b/2.3.0/arm64/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.3.0/arm64/alpine/entrypoint.sh +++ b/2.3.0/arm64/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.3.0/arm64/debian/entrypoint.sh b/2.3.0/arm64/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.3.0/arm64/debian/entrypoint.sh +++ b/2.3.0/arm64/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.3.0/armhf/alpine/entrypoint.sh b/2.3.0/armhf/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.3.0/armhf/alpine/entrypoint.sh +++ b/2.3.0/armhf/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.3.0/armhf/debian/entrypoint.sh b/2.3.0/armhf/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.3.0/armhf/debian/entrypoint.sh +++ b/2.3.0/armhf/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.3.0/i386/alpine/entrypoint.sh b/2.3.0/i386/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.3.0/i386/alpine/entrypoint.sh +++ b/2.3.0/i386/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.3.0/i386/debian/entrypoint.sh b/2.3.0/i386/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.3.0/i386/debian/entrypoint.sh +++ b/2.3.0/i386/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.4.0-snapshot/amd64/alpine/entrypoint.sh b/2.4.0-snapshot/amd64/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.4.0-snapshot/amd64/alpine/entrypoint.sh +++ b/2.4.0-snapshot/amd64/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.4.0-snapshot/amd64/debian/entrypoint.sh b/2.4.0-snapshot/amd64/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.4.0-snapshot/amd64/debian/entrypoint.sh +++ b/2.4.0-snapshot/amd64/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.4.0-snapshot/arm64/alpine/entrypoint.sh b/2.4.0-snapshot/arm64/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.4.0-snapshot/arm64/alpine/entrypoint.sh +++ b/2.4.0-snapshot/arm64/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.4.0-snapshot/arm64/debian/entrypoint.sh b/2.4.0-snapshot/arm64/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.4.0-snapshot/arm64/debian/entrypoint.sh +++ b/2.4.0-snapshot/arm64/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.4.0-snapshot/armhf/alpine/entrypoint.sh b/2.4.0-snapshot/armhf/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.4.0-snapshot/armhf/alpine/entrypoint.sh +++ b/2.4.0-snapshot/armhf/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.4.0-snapshot/armhf/debian/entrypoint.sh b/2.4.0-snapshot/armhf/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.4.0-snapshot/armhf/debian/entrypoint.sh +++ b/2.4.0-snapshot/armhf/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.4.0-snapshot/i386/alpine/entrypoint.sh b/2.4.0-snapshot/i386/alpine/entrypoint.sh index ba30c26..bd72a07 100755 --- a/2.4.0-snapshot/i386/alpine/entrypoint.sh +++ b/2.4.0-snapshot/i386/alpine/entrypoint.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.4.0-snapshot/i386/debian/entrypoint.sh b/2.4.0-snapshot/i386/debian/entrypoint.sh index b320c1a..d058008 100755 --- a/2.4.0-snapshot/i386/debian/entrypoint.sh +++ b/2.4.0-snapshot/i386/debian/entrypoint.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/2.4.0.M3/amd64/alpine/Dockerfile b/2.4.0.M3/amd64/alpine/Dockerfile new file mode 100644 index 0000000..2a87607 --- /dev/null +++ b/2.4.0.M3/amd64/alpine/Dockerfile @@ -0,0 +1,98 @@ +# openhab image +# +# ------------------------------------------------------------------------------ +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# ------------------------------------------------------------------------------ +# +FROM multiarch/alpine:amd64-v3.8 + +# Set download urls +ENV \ + JAVA_URL="https://www.azul.com/downloads/zulu/zdk-8-ga-linux_x64.tar.gz" \ + OPENHAB_URL="https://openhab.jfrog.io/openhab/libs-milestone-local/org/openhab/distro/openhab/2.4.0.M3/openhab-2.4.0.M3.zip" \ + OPENHAB_VERSION="2.4.0.M3" + +# Set variables and locales +ENV \ + APPDIR="/openhab" \ + EXTRA_JAVA_OPTS="" \ + OPENHAB_HTTP_PORT="8080" \ + OPENHAB_HTTPS_PORT="8443" \ + LC_ALL="en_US.UTF-8" \ + LANG="en_US.UTF-8" \ + LANGUAGE="en_US.UTF-8" \ + CRYPTO_POLICY="limited" + +# Set arguments on build +ARG BUILD_DATE +ARG VCS_REF +ARG VERSION + +# Basic build-time metadata as defined at http://label-schema.org +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.docker.dockerfile="/Dockerfile" \ + org.label-schema.license="EPL" \ + org.label-schema.name="openHAB" \ + org.label-schema.vendor="openHAB Foundation e.V." \ + org.label-schema.version=$VERSION \ + org.label-schema.description="An open source, technology agnostic home automation platform" \ + org.label-schema.url="https://www.openhab.com/" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-type="Git" \ + org.label-schema.vcs-url="https://github.com/openhab/openhab-docker.git" \ + maintainer="openHAB " + +# Install basepackages +RUN apk upgrade --no-cache && \ + apk add --no-cache --virtual build-dependencies dpkg gnupg && \ + apk add --no-cache \ + arping \ + bash \ + ca-certificates \ + fontconfig \ + libpcap-dev \ + shadow \ + su-exec \ + ttf-dejavu \ + openjdk8 \ + unzip \ + wget \ + zip && \ + chmod u+s /usr/sbin/arping + +# Limit OpenJDK crypto policy by default to comply with local laws which may prohibit use of unlimited strength cryptography +ENV JAVA_HOME='/usr/lib/jvm/java-1.8-openjdk' +RUN rm -r "$JAVA_HOME/jre/lib/security/policy/unlimited" && \ + sed -i 's/^crypto.policy=unlimited/crypto.policy=limited/' "$JAVA_HOME/jre/lib/security/java.security" + +# Install openhab +# Set permissions for openhab. Export TERM variable. See issue #30 for details! +RUN wget -nv -O /tmp/openhab.zip "${OPENHAB_URL}" && \ + unzip -q /tmp/openhab.zip -d "${APPDIR}" && \ + rm /tmp/openhab.zip && \ + mkdir -p "${APPDIR}/userdata/logs" && \ + touch "${APPDIR}/userdata/logs/openhab.log" && \ + cp -a "${APPDIR}/userdata" "${APPDIR}/userdata.dist" && \ + cp -a "${APPDIR}/conf" "${APPDIR}/conf.dist" && \ + echo "export TERM=dumb" | tee -a ~/.bashrc + +# Expose volume with configuration and userdata dir +VOLUME ${APPDIR}/conf ${APPDIR}/userdata ${APPDIR}/addons + +# Reduce image size by removing files that are used only for building the image +RUN apk del build-dependencies && \ + rm -rf /var/cache/apk/* + +# Expose HTTP, HTTPS, Console and LSP ports +EXPOSE 8080 8443 8101 5007 + +# Set working directory and entrypoint +WORKDIR ${APPDIR} +COPY entrypoint.sh / +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + +# Execute command +CMD ["su-exec", "openhab", "./start.sh"] diff --git a/2.4.0.M3/amd64/alpine/entrypoint.sh b/2.4.0.M3/amd64/alpine/entrypoint.sh new file mode 100644 index 0000000..bd72a07 --- /dev/null +++ b/2.4.0.M3/amd64/alpine/entrypoint.sh @@ -0,0 +1,121 @@ +#!/bin/bash -x + +interactive=$(if test -t 0; then echo true; else echo false; fi) +set -euo pipefail +IFS=$'\n\t' + +# Install Java unlimited strength cryptography +if [ "${CRYPTO_POLICY}" = "unlimited" ] && [ ! -d "${JAVA_HOME}/jre/lib/security/policy/unlimited" ]; then + echo "Installing OpenJDK unlimited strength cryptography policy..." + apk fix --no-cache openjdk8-jre-lib +fi + +# Deleting instance.properties to avoid karaf PID conflict on restart +# See: https://github.com/openhab/openhab-docker/issues/99 +rm -f /openhab/runtime/instances/instance.properties + +# The instance.properties file in OH2.x is installed in the tmp +# directory +rm -f /openhab/userdata/tmp/instances/instance.properties + +# Add openhab user & handle possible device groups for different host systems +# Container base image puts dialout on group id 20, uucp on id 14 +# GPIO Group for RPI access +NEW_USER_ID=${USER_ID:-9001} +NEW_GROUP_ID=${GROUP_ID:-$NEW_USER_ID} +echo "Starting with openhab user id: $NEW_USER_ID and group id: $NEW_GROUP_ID" +if ! id -u openhab >/dev/null 2>&1; then + echo "Create group openhab with id ${NEW_GROUP_ID}" + addgroup -g $NEW_GROUP_ID openhab + echo "Create user openhab with id ${NEW_USER_ID}" + adduser -u $NEW_USER_ID -D -g '' -h ${APPDIR} -G openhab openhab + adduser openhab dialout + adduser openhab uucp +fi + +# Copy initial files to host volume +case ${OPENHAB_VERSION} in + 1.8.3) + if [ -z "$(ls -A "${APPDIR}/configurations")" ]; then + # Copy userdata dir for version 1.8.3 + echo "No configuration found... initializing." + cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" + fi + ;; + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) + # Initialize empty host volumes + if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No userdata found... initializing." + cp -av "${APPDIR}/userdata.dist/." "${APPDIR}/userdata/" + fi + + # Upgrade userdata if versions do not match + if [ ! -z $(cmp "${APPDIR}/userdata/etc/version.properties" "${APPDIR}/userdata.dist/etc/version.properties") ]; then + echo "Image and userdata versions differ! Starting an upgrade." + + # Make a backup of userdata + backupFile=userdata-$(date +"%FT%H-%M-%S").tar + if [ ! -d "${APPDIR}/userdata/backup" ]; then + mkdir "${APPDIR}/userdata/backup" + fi + tar -c -f "${APPDIR}/userdata/backup/${backupFile}" --exclude "backup/*" "${APPDIR}/userdata" + echo "You can find backup of userdata in ${APPDIR}/userdata/backup/${backupFile}" + + # Copy over the updated files + cp "${APPDIR}/userdata.dist/etc/all.policy" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding-ssh.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/config.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/custom.properties" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/custom.system.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/custom.system.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/distribution.info" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/jre.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.apache.karaf"* "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.ops4j.pax.url.mvn.cfg" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/overrides.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/profile.cfg" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/startup.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/system.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/version.properties" "${APPDIR}/userdata/etc/" + echo "Replaced files in userdata/etc with newer versions" + + # Remove necessary files after installation + rm -rf "${APPDIR}/userdata/etc/org.openhab.addons.cfg" + if [ ! -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + rm -rf "${APPDIR}/userdata/etc/overrides.properties" + fi + + # Clear the cache and tmp + rm -rf "${APPDIR}/userdata/cache" + rm -rf "${APPDIR}/userdata/tmp" + mkdir "${APPDIR}/userdata/cache" + mkdir "${APPDIR}/userdata/tmp" + echo "Cleared the cache and tmp" + fi + + if [ -z "$(ls -A "${APPDIR}/conf")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No configuration found... initializing." + cp -av "${APPDIR}/conf.dist/." "${APPDIR}/conf/" + fi + ;; + *) + echo openHAB version ${OPENHAB_VERSION} not supported! + ;; +esac + +# Set openhab folder permission +chown -R openhab:openhab ${APPDIR} + +# Use server mode with the default command when there is no pseudo-TTY +if [ "$interactive" == "false" ] && [ "$(IFS=" "; echo "$@")" == "su-exec openhab ./start.sh" ]; then + command=($@ server) + exec "${command[@]}" +else + exec "$@" +fi diff --git a/2.4.0.M3/amd64/debian/Dockerfile b/2.4.0.M3/amd64/debian/Dockerfile new file mode 100644 index 0000000..b8c66fa --- /dev/null +++ b/2.4.0.M3/amd64/debian/Dockerfile @@ -0,0 +1,104 @@ +# openhab image +# +# ------------------------------------------------------------------------------ +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# ------------------------------------------------------------------------------ +# +FROM multiarch/debian-debootstrap:amd64-stretch + +# Set download urls +ENV \ + JAVA_URL="https://www.azul.com/downloads/zulu/zdk-8-ga-linux_x64.tar.gz" \ + OPENHAB_URL="https://openhab.jfrog.io/openhab/libs-milestone-local/org/openhab/distro/openhab/2.4.0.M3/openhab-2.4.0.M3.zip" \ + OPENHAB_VERSION="2.4.0.M3" + +# Set variables and locales +ENV \ + APPDIR="/openhab" \ + EXTRA_JAVA_OPTS="" \ + OPENHAB_HTTP_PORT="8080" \ + OPENHAB_HTTPS_PORT="8443" \ + LC_ALL="en_US.UTF-8" \ + LANG="en_US.UTF-8" \ + LANGUAGE="en_US.UTF-8" \ + CRYPTO_POLICY="limited" + +# Set arguments on build +ARG BUILD_DATE +ARG VCS_REF +ARG VERSION + +# Basic build-time metadata as defined at http://label-schema.org +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.docker.dockerfile="/Dockerfile" \ + org.label-schema.license="EPL" \ + org.label-schema.name="openHAB" \ + org.label-schema.vendor="openHAB Foundation e.V." \ + org.label-schema.version=$VERSION \ + org.label-schema.description="An open source, technology agnostic home automation platform" \ + org.label-schema.url="https://www.openhab.com/" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-type="Git" \ + org.label-schema.vcs-url="https://github.com/openhab/openhab-docker.git" \ + maintainer="openHAB " + +# Install basepackages +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ + arping \ + ca-certificates \ + dirmngr \ + fontconfig \ + gnupg \ + gosu \ + libpcap-dev \ + locales \ + locales-all \ + netbase \ + unzip \ + wget \ + zip && \ + chmod u+s /usr/sbin/arping && \ + ln -s -f /bin/true /usr/bin/chfn + +# Install java +ENV JAVA_HOME='/usr/lib/java-8' +RUN wget -nv -O /tmp/java.tar.gz "${JAVA_URL}" && \ + mkdir "${JAVA_HOME}" && \ + tar --exclude='demo' --exclude='sample' --exclude='src.zip' -xvf /tmp/java.tar.gz --strip-components=1 -C "${JAVA_HOME}" && \ + rm /tmp/java.tar.gz && \ + update-alternatives --install /usr/bin/java java "${JAVA_HOME}/bin/java" 50 && \ + update-alternatives --install /usr/bin/javac javac "${JAVA_HOME}/bin/javac" 50 + +# Install openhab +# Set permissions for openhab. Export TERM variable. See issue #30 for details! +RUN wget -nv -O /tmp/openhab.zip "${OPENHAB_URL}" && \ + unzip -q /tmp/openhab.zip -d "${APPDIR}" && \ + rm /tmp/openhab.zip && \ + mkdir -p "${APPDIR}/userdata/logs" && \ + touch "${APPDIR}/userdata/logs/openhab.log" && \ + cp -a "${APPDIR}/userdata" "${APPDIR}/userdata.dist" && \ + cp -a "${APPDIR}/conf" "${APPDIR}/conf.dist" && \ + echo "export TERM=dumb" | tee -a ~/.bashrc + +# Expose volume with configuration and userdata dir +VOLUME ${APPDIR}/conf ${APPDIR}/userdata ${APPDIR}/addons + +# Reduce image size by removing files that are used only for building the image +RUN DEBIAN_FRONTEND=noninteractive apt-get remove -y dirmngr gnupg && \ + DEBIAN_FRONTEND=noninteractive apt-get autoremove -y && \ + rm -rf /var/lib/apt/lists/* + +# Expose HTTP, HTTPS, Console and LSP ports +EXPOSE 8080 8443 8101 5007 + +# Set working directory and entrypoint +WORKDIR ${APPDIR} +COPY entrypoint.sh / +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + +# Execute command +CMD ["gosu", "openhab", "./start.sh"] diff --git a/2.4.0.M3/amd64/debian/entrypoint.sh b/2.4.0.M3/amd64/debian/entrypoint.sh new file mode 100644 index 0000000..d058008 --- /dev/null +++ b/2.4.0.M3/amd64/debian/entrypoint.sh @@ -0,0 +1,133 @@ +#!/bin/bash -x + +interactive=$(if test -t 0; then echo true; else echo false; fi) +set -euo pipefail +IFS=$'\n\t' + +# Install Java unlimited strength cryptography +if [ "${CRYPTO_POLICY}" = "unlimited" ] && [ ! -f "${JAVA_HOME}/jre/lib/security/README.txt" ]; then + echo "Installing Zulu Cryptography Extension Kit (\"CEK\")..." + wget -q -O /tmp/ZuluJCEPolicies.zip https://cdn.azul.com/zcek/bin/ZuluJCEPolicies.zip + unzip -jo -d ${JAVA_HOME}/jre/lib/security /tmp/ZuluJCEPolicies.zip + rm /tmp/ZuluJCEPolicies.zip +fi + +# Deleting instance.properties to avoid karaf PID conflict on restart +# See: https://github.com/openhab/openhab-docker/issues/99 +rm -f /openhab/runtime/instances/instance.properties + +# The instance.properties file in OH2.x is installed in the tmp +# directory +rm -f /openhab/userdata/tmp/instances/instance.properties + +# Add openhab user & handle possible device groups for different host systems +# Container base image puts dialout on group id 20, uucp on id 10 +# GPIO Group for RPI access +NEW_USER_ID=${USER_ID:-9001} +NEW_GROUP_ID=${GROUP_ID:-$NEW_USER_ID} +echo "Starting with openhab user id: $NEW_USER_ID and group id: $NEW_GROUP_ID" +if ! id -u openhab >/dev/null 2>&1; then + echo "Create group openhab with id ${NEW_GROUP_ID}" + groupadd -g $NEW_GROUP_ID openhab + echo "Create user openhab with id ${NEW_USER_ID}" + adduser -u $NEW_USER_ID --disabled-password --gecos '' --home ${APPDIR} --gid $NEW_GROUP_ID openhab + groupadd -g 14 uucp2 + groupadd -g 16 dialout2 + groupadd -g 18 dialout3 + groupadd -g 32 uucp3 + groupadd -g 997 gpio + adduser openhab dialout + adduser openhab uucp + adduser openhab uucp2 + adduser openhab dialout2 + adduser openhab dialout3 + adduser openhab uucp3 + adduser openhab gpio +fi + +# Copy initial files to host volume +case ${OPENHAB_VERSION} in + 1.8.3) + if [ -z "$(ls -A "${APPDIR}/configurations")" ]; then + # Copy userdata dir for version 1.8.3 + echo "No configuration found... initializing." + cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" + fi + ;; + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) + # Initialize empty host volumes + if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No userdata found... initializing." + cp -av "${APPDIR}/userdata.dist/." "${APPDIR}/userdata/" + fi + + # Upgrade userdata if versions do not match + if [ ! -z $(cmp "${APPDIR}/userdata/etc/version.properties" "${APPDIR}/userdata.dist/etc/version.properties") ]; then + echo "Image and userdata versions differ! Starting an upgrade." + + # Make a backup of userdata + backupFile=userdata-$(date +"%FT%H-%M-%S").tar + if [ ! -d "${APPDIR}/userdata/backup" ]; then + mkdir "${APPDIR}/userdata/backup" + fi + tar --exclude="${APPDIR}/userdata/backup" -c -f "${APPDIR}/userdata/backup/${backupFile}" "${APPDIR}/userdata" + echo "You can find backup of userdata in ${APPDIR}/userdata/backup/${backupFile}" + + # Copy over the updated files + cp "${APPDIR}/userdata.dist/etc/all.policy" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding-ssh.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/config.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/custom.properties" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/custom.system.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/custom.system.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/distribution.info" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/jre.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.apache.karaf"* "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.ops4j.pax.url.mvn.cfg" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/overrides.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/profile.cfg" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/startup.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/system.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/version.properties" "${APPDIR}/userdata/etc/" + echo "Replaced files in userdata/etc with newer versions" + + # Remove necessary files after installation + rm -rf "${APPDIR}/userdata/etc/org.openhab.addons.cfg" + if [ ! -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + rm -rf "${APPDIR}/userdata/etc/overrides.properties" + fi + + # Clear the cache and tmp + rm -rf "${APPDIR}/userdata/cache" + rm -rf "${APPDIR}/userdata/tmp" + mkdir "${APPDIR}/userdata/cache" + mkdir "${APPDIR}/userdata/tmp" + echo "Cleared the cache and tmp" + fi + + if [ -z "$(ls -A "${APPDIR}/conf")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No configuration found... initializing." + cp -av "${APPDIR}/conf.dist/." "${APPDIR}/conf/" + fi + ;; + *) + echo openHAB version ${OPENHAB_VERSION} not supported! + ;; +esac + +# Set openhab folder permission +chown -R openhab:openhab ${APPDIR} + +# Use server mode with the default command when there is no pseudo-TTY +if [ "$interactive" == "false" ] && [ "$(IFS=" "; echo "$@")" == "gosu openhab ./start.sh" ]; then + command=($@ server) + exec "${command[@]}" +else + exec "$@" +fi diff --git a/2.4.0.M3/arm64/alpine/Dockerfile b/2.4.0.M3/arm64/alpine/Dockerfile new file mode 100644 index 0000000..72bcfdc --- /dev/null +++ b/2.4.0.M3/arm64/alpine/Dockerfile @@ -0,0 +1,98 @@ +# openhab image +# +# ------------------------------------------------------------------------------ +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# ------------------------------------------------------------------------------ +# +FROM multiarch/alpine:arm64-v3.8 + +# Set download urls +ENV \ + JAVA_URL="https://www.azul.com/downloads/zulu/zdk-8-ga-linux_aarch32hf.tar.gz" \ + OPENHAB_URL="https://openhab.jfrog.io/openhab/libs-milestone-local/org/openhab/distro/openhab/2.4.0.M3/openhab-2.4.0.M3.zip" \ + OPENHAB_VERSION="2.4.0.M3" + +# Set variables and locales +ENV \ + APPDIR="/openhab" \ + EXTRA_JAVA_OPTS="" \ + OPENHAB_HTTP_PORT="8080" \ + OPENHAB_HTTPS_PORT="8443" \ + LC_ALL="en_US.UTF-8" \ + LANG="en_US.UTF-8" \ + LANGUAGE="en_US.UTF-8" \ + CRYPTO_POLICY="limited" + +# Set arguments on build +ARG BUILD_DATE +ARG VCS_REF +ARG VERSION + +# Basic build-time metadata as defined at http://label-schema.org +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.docker.dockerfile="/Dockerfile" \ + org.label-schema.license="EPL" \ + org.label-schema.name="openHAB" \ + org.label-schema.vendor="openHAB Foundation e.V." \ + org.label-schema.version=$VERSION \ + org.label-schema.description="An open source, technology agnostic home automation platform" \ + org.label-schema.url="https://www.openhab.com/" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-type="Git" \ + org.label-schema.vcs-url="https://github.com/openhab/openhab-docker.git" \ + maintainer="openHAB " + +# Install basepackages +RUN apk upgrade --no-cache && \ + apk add --no-cache --virtual build-dependencies dpkg gnupg && \ + apk add --no-cache \ + arping \ + bash \ + ca-certificates \ + fontconfig \ + libpcap-dev \ + shadow \ + su-exec \ + ttf-dejavu \ + openjdk8 \ + unzip \ + wget \ + zip && \ + chmod u+s /usr/sbin/arping + +# Limit OpenJDK crypto policy by default to comply with local laws which may prohibit use of unlimited strength cryptography +ENV JAVA_HOME='/usr/lib/jvm/java-1.8-openjdk' +RUN rm -r "$JAVA_HOME/jre/lib/security/policy/unlimited" && \ + sed -i 's/^crypto.policy=unlimited/crypto.policy=limited/' "$JAVA_HOME/jre/lib/security/java.security" + +# Install openhab +# Set permissions for openhab. Export TERM variable. See issue #30 for details! +RUN wget -nv -O /tmp/openhab.zip "${OPENHAB_URL}" && \ + unzip -q /tmp/openhab.zip -d "${APPDIR}" && \ + rm /tmp/openhab.zip && \ + mkdir -p "${APPDIR}/userdata/logs" && \ + touch "${APPDIR}/userdata/logs/openhab.log" && \ + cp -a "${APPDIR}/userdata" "${APPDIR}/userdata.dist" && \ + cp -a "${APPDIR}/conf" "${APPDIR}/conf.dist" && \ + echo "export TERM=dumb" | tee -a ~/.bashrc + +# Expose volume with configuration and userdata dir +VOLUME ${APPDIR}/conf ${APPDIR}/userdata ${APPDIR}/addons + +# Reduce image size by removing files that are used only for building the image +RUN apk del build-dependencies && \ + rm -rf /var/cache/apk/* + +# Expose HTTP, HTTPS, Console and LSP ports +EXPOSE 8080 8443 8101 5007 + +# Set working directory and entrypoint +WORKDIR ${APPDIR} +COPY entrypoint.sh / +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + +# Execute command +CMD ["su-exec", "openhab", "./start.sh"] diff --git a/2.4.0.M3/arm64/alpine/entrypoint.sh b/2.4.0.M3/arm64/alpine/entrypoint.sh new file mode 100644 index 0000000..bd72a07 --- /dev/null +++ b/2.4.0.M3/arm64/alpine/entrypoint.sh @@ -0,0 +1,121 @@ +#!/bin/bash -x + +interactive=$(if test -t 0; then echo true; else echo false; fi) +set -euo pipefail +IFS=$'\n\t' + +# Install Java unlimited strength cryptography +if [ "${CRYPTO_POLICY}" = "unlimited" ] && [ ! -d "${JAVA_HOME}/jre/lib/security/policy/unlimited" ]; then + echo "Installing OpenJDK unlimited strength cryptography policy..." + apk fix --no-cache openjdk8-jre-lib +fi + +# Deleting instance.properties to avoid karaf PID conflict on restart +# See: https://github.com/openhab/openhab-docker/issues/99 +rm -f /openhab/runtime/instances/instance.properties + +# The instance.properties file in OH2.x is installed in the tmp +# directory +rm -f /openhab/userdata/tmp/instances/instance.properties + +# Add openhab user & handle possible device groups for different host systems +# Container base image puts dialout on group id 20, uucp on id 14 +# GPIO Group for RPI access +NEW_USER_ID=${USER_ID:-9001} +NEW_GROUP_ID=${GROUP_ID:-$NEW_USER_ID} +echo "Starting with openhab user id: $NEW_USER_ID and group id: $NEW_GROUP_ID" +if ! id -u openhab >/dev/null 2>&1; then + echo "Create group openhab with id ${NEW_GROUP_ID}" + addgroup -g $NEW_GROUP_ID openhab + echo "Create user openhab with id ${NEW_USER_ID}" + adduser -u $NEW_USER_ID -D -g '' -h ${APPDIR} -G openhab openhab + adduser openhab dialout + adduser openhab uucp +fi + +# Copy initial files to host volume +case ${OPENHAB_VERSION} in + 1.8.3) + if [ -z "$(ls -A "${APPDIR}/configurations")" ]; then + # Copy userdata dir for version 1.8.3 + echo "No configuration found... initializing." + cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" + fi + ;; + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) + # Initialize empty host volumes + if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No userdata found... initializing." + cp -av "${APPDIR}/userdata.dist/." "${APPDIR}/userdata/" + fi + + # Upgrade userdata if versions do not match + if [ ! -z $(cmp "${APPDIR}/userdata/etc/version.properties" "${APPDIR}/userdata.dist/etc/version.properties") ]; then + echo "Image and userdata versions differ! Starting an upgrade." + + # Make a backup of userdata + backupFile=userdata-$(date +"%FT%H-%M-%S").tar + if [ ! -d "${APPDIR}/userdata/backup" ]; then + mkdir "${APPDIR}/userdata/backup" + fi + tar -c -f "${APPDIR}/userdata/backup/${backupFile}" --exclude "backup/*" "${APPDIR}/userdata" + echo "You can find backup of userdata in ${APPDIR}/userdata/backup/${backupFile}" + + # Copy over the updated files + cp "${APPDIR}/userdata.dist/etc/all.policy" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding-ssh.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/config.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/custom.properties" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/custom.system.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/custom.system.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/distribution.info" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/jre.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.apache.karaf"* "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.ops4j.pax.url.mvn.cfg" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/overrides.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/profile.cfg" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/startup.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/system.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/version.properties" "${APPDIR}/userdata/etc/" + echo "Replaced files in userdata/etc with newer versions" + + # Remove necessary files after installation + rm -rf "${APPDIR}/userdata/etc/org.openhab.addons.cfg" + if [ ! -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + rm -rf "${APPDIR}/userdata/etc/overrides.properties" + fi + + # Clear the cache and tmp + rm -rf "${APPDIR}/userdata/cache" + rm -rf "${APPDIR}/userdata/tmp" + mkdir "${APPDIR}/userdata/cache" + mkdir "${APPDIR}/userdata/tmp" + echo "Cleared the cache and tmp" + fi + + if [ -z "$(ls -A "${APPDIR}/conf")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No configuration found... initializing." + cp -av "${APPDIR}/conf.dist/." "${APPDIR}/conf/" + fi + ;; + *) + echo openHAB version ${OPENHAB_VERSION} not supported! + ;; +esac + +# Set openhab folder permission +chown -R openhab:openhab ${APPDIR} + +# Use server mode with the default command when there is no pseudo-TTY +if [ "$interactive" == "false" ] && [ "$(IFS=" "; echo "$@")" == "su-exec openhab ./start.sh" ]; then + command=($@ server) + exec "${command[@]}" +else + exec "$@" +fi diff --git a/2.4.0.M3/arm64/debian/Dockerfile b/2.4.0.M3/arm64/debian/Dockerfile new file mode 100644 index 0000000..355123b --- /dev/null +++ b/2.4.0.M3/arm64/debian/Dockerfile @@ -0,0 +1,109 @@ +# openhab image +# +# ------------------------------------------------------------------------------ +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# ------------------------------------------------------------------------------ +# +FROM multiarch/debian-debootstrap:arm64-stretch + +# Set download urls +ENV \ + JAVA_URL="https://www.azul.com/downloads/zulu/zdk-8-ga-linux_aarch32hf.tar.gz" \ + OPENHAB_URL="https://openhab.jfrog.io/openhab/libs-milestone-local/org/openhab/distro/openhab/2.4.0.M3/openhab-2.4.0.M3.zip" \ + OPENHAB_VERSION="2.4.0.M3" + +# Set variables and locales +ENV \ + APPDIR="/openhab" \ + EXTRA_JAVA_OPTS="" \ + OPENHAB_HTTP_PORT="8080" \ + OPENHAB_HTTPS_PORT="8443" \ + LC_ALL="en_US.UTF-8" \ + LANG="en_US.UTF-8" \ + LANGUAGE="en_US.UTF-8" \ + CRYPTO_POLICY="limited" + +# Set arguments on build +ARG BUILD_DATE +ARG VCS_REF +ARG VERSION + +# Basic build-time metadata as defined at http://label-schema.org +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.docker.dockerfile="/Dockerfile" \ + org.label-schema.license="EPL" \ + org.label-schema.name="openHAB" \ + org.label-schema.vendor="openHAB Foundation e.V." \ + org.label-schema.version=$VERSION \ + org.label-schema.description="An open source, technology agnostic home automation platform" \ + org.label-schema.url="https://www.openhab.com/" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-type="Git" \ + org.label-schema.vcs-url="https://github.com/openhab/openhab-docker.git" \ + maintainer="openHAB " + +# Install basepackages +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ + arping \ + ca-certificates \ + dirmngr \ + fontconfig \ + gnupg \ + gosu \ + libpcap-dev \ + locales \ + locales-all \ + netbase \ + unzip \ + wget \ + zip && \ + chmod u+s /usr/sbin/arping && \ + ln -s -f /bin/true /usr/bin/chfn + +# Install java +ENV JAVA_HOME='/usr/lib/java-8' +RUN wget -nv -O /tmp/java.tar.gz "${JAVA_URL}" && \ + mkdir "${JAVA_HOME}" && \ + tar --exclude='demo' --exclude='sample' --exclude='src.zip' -xvf /tmp/java.tar.gz --strip-components=1 -C "${JAVA_HOME}" && \ + rm /tmp/java.tar.gz && \ + update-alternatives --install /usr/bin/java java "${JAVA_HOME}/bin/java" 50 && \ + update-alternatives --install /usr/bin/javac javac "${JAVA_HOME}/bin/javac" 50 + +RUN dpkg --add-architecture armhf && \ + apt-get update && \ + apt-get install --no-install-recommends -y \ + libc6:armhf + +# Install openhab +# Set permissions for openhab. Export TERM variable. See issue #30 for details! +RUN wget -nv -O /tmp/openhab.zip "${OPENHAB_URL}" && \ + unzip -q /tmp/openhab.zip -d "${APPDIR}" && \ + rm /tmp/openhab.zip && \ + mkdir -p "${APPDIR}/userdata/logs" && \ + touch "${APPDIR}/userdata/logs/openhab.log" && \ + cp -a "${APPDIR}/userdata" "${APPDIR}/userdata.dist" && \ + cp -a "${APPDIR}/conf" "${APPDIR}/conf.dist" && \ + echo "export TERM=dumb" | tee -a ~/.bashrc + +# Expose volume with configuration and userdata dir +VOLUME ${APPDIR}/conf ${APPDIR}/userdata ${APPDIR}/addons + +# Reduce image size by removing files that are used only for building the image +RUN DEBIAN_FRONTEND=noninteractive apt-get remove -y dirmngr gnupg && \ + DEBIAN_FRONTEND=noninteractive apt-get autoremove -y && \ + rm -rf /var/lib/apt/lists/* + +# Expose HTTP, HTTPS, Console and LSP ports +EXPOSE 8080 8443 8101 5007 + +# Set working directory and entrypoint +WORKDIR ${APPDIR} +COPY entrypoint.sh / +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + +# Execute command +CMD ["gosu", "openhab", "./start.sh"] diff --git a/2.4.0.M3/arm64/debian/entrypoint.sh b/2.4.0.M3/arm64/debian/entrypoint.sh new file mode 100644 index 0000000..d058008 --- /dev/null +++ b/2.4.0.M3/arm64/debian/entrypoint.sh @@ -0,0 +1,133 @@ +#!/bin/bash -x + +interactive=$(if test -t 0; then echo true; else echo false; fi) +set -euo pipefail +IFS=$'\n\t' + +# Install Java unlimited strength cryptography +if [ "${CRYPTO_POLICY}" = "unlimited" ] && [ ! -f "${JAVA_HOME}/jre/lib/security/README.txt" ]; then + echo "Installing Zulu Cryptography Extension Kit (\"CEK\")..." + wget -q -O /tmp/ZuluJCEPolicies.zip https://cdn.azul.com/zcek/bin/ZuluJCEPolicies.zip + unzip -jo -d ${JAVA_HOME}/jre/lib/security /tmp/ZuluJCEPolicies.zip + rm /tmp/ZuluJCEPolicies.zip +fi + +# Deleting instance.properties to avoid karaf PID conflict on restart +# See: https://github.com/openhab/openhab-docker/issues/99 +rm -f /openhab/runtime/instances/instance.properties + +# The instance.properties file in OH2.x is installed in the tmp +# directory +rm -f /openhab/userdata/tmp/instances/instance.properties + +# Add openhab user & handle possible device groups for different host systems +# Container base image puts dialout on group id 20, uucp on id 10 +# GPIO Group for RPI access +NEW_USER_ID=${USER_ID:-9001} +NEW_GROUP_ID=${GROUP_ID:-$NEW_USER_ID} +echo "Starting with openhab user id: $NEW_USER_ID and group id: $NEW_GROUP_ID" +if ! id -u openhab >/dev/null 2>&1; then + echo "Create group openhab with id ${NEW_GROUP_ID}" + groupadd -g $NEW_GROUP_ID openhab + echo "Create user openhab with id ${NEW_USER_ID}" + adduser -u $NEW_USER_ID --disabled-password --gecos '' --home ${APPDIR} --gid $NEW_GROUP_ID openhab + groupadd -g 14 uucp2 + groupadd -g 16 dialout2 + groupadd -g 18 dialout3 + groupadd -g 32 uucp3 + groupadd -g 997 gpio + adduser openhab dialout + adduser openhab uucp + adduser openhab uucp2 + adduser openhab dialout2 + adduser openhab dialout3 + adduser openhab uucp3 + adduser openhab gpio +fi + +# Copy initial files to host volume +case ${OPENHAB_VERSION} in + 1.8.3) + if [ -z "$(ls -A "${APPDIR}/configurations")" ]; then + # Copy userdata dir for version 1.8.3 + echo "No configuration found... initializing." + cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" + fi + ;; + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) + # Initialize empty host volumes + if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No userdata found... initializing." + cp -av "${APPDIR}/userdata.dist/." "${APPDIR}/userdata/" + fi + + # Upgrade userdata if versions do not match + if [ ! -z $(cmp "${APPDIR}/userdata/etc/version.properties" "${APPDIR}/userdata.dist/etc/version.properties") ]; then + echo "Image and userdata versions differ! Starting an upgrade." + + # Make a backup of userdata + backupFile=userdata-$(date +"%FT%H-%M-%S").tar + if [ ! -d "${APPDIR}/userdata/backup" ]; then + mkdir "${APPDIR}/userdata/backup" + fi + tar --exclude="${APPDIR}/userdata/backup" -c -f "${APPDIR}/userdata/backup/${backupFile}" "${APPDIR}/userdata" + echo "You can find backup of userdata in ${APPDIR}/userdata/backup/${backupFile}" + + # Copy over the updated files + cp "${APPDIR}/userdata.dist/etc/all.policy" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding-ssh.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/config.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/custom.properties" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/custom.system.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/custom.system.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/distribution.info" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/jre.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.apache.karaf"* "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.ops4j.pax.url.mvn.cfg" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/overrides.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/profile.cfg" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/startup.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/system.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/version.properties" "${APPDIR}/userdata/etc/" + echo "Replaced files in userdata/etc with newer versions" + + # Remove necessary files after installation + rm -rf "${APPDIR}/userdata/etc/org.openhab.addons.cfg" + if [ ! -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + rm -rf "${APPDIR}/userdata/etc/overrides.properties" + fi + + # Clear the cache and tmp + rm -rf "${APPDIR}/userdata/cache" + rm -rf "${APPDIR}/userdata/tmp" + mkdir "${APPDIR}/userdata/cache" + mkdir "${APPDIR}/userdata/tmp" + echo "Cleared the cache and tmp" + fi + + if [ -z "$(ls -A "${APPDIR}/conf")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No configuration found... initializing." + cp -av "${APPDIR}/conf.dist/." "${APPDIR}/conf/" + fi + ;; + *) + echo openHAB version ${OPENHAB_VERSION} not supported! + ;; +esac + +# Set openhab folder permission +chown -R openhab:openhab ${APPDIR} + +# Use server mode with the default command when there is no pseudo-TTY +if [ "$interactive" == "false" ] && [ "$(IFS=" "; echo "$@")" == "gosu openhab ./start.sh" ]; then + command=($@ server) + exec "${command[@]}" +else + exec "$@" +fi diff --git a/2.4.0.M3/armhf/alpine/Dockerfile b/2.4.0.M3/armhf/alpine/Dockerfile new file mode 100644 index 0000000..73fbb83 --- /dev/null +++ b/2.4.0.M3/armhf/alpine/Dockerfile @@ -0,0 +1,98 @@ +# openhab image +# +# ------------------------------------------------------------------------------ +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# ------------------------------------------------------------------------------ +# +FROM multiarch/alpine:armhf-v3.8 + +# Set download urls +ENV \ + JAVA_URL="https://www.azul.com/downloads/zulu/zdk-8-ga-linux_aarch32hf.tar.gz" \ + OPENHAB_URL="https://openhab.jfrog.io/openhab/libs-milestone-local/org/openhab/distro/openhab/2.4.0.M3/openhab-2.4.0.M3.zip" \ + OPENHAB_VERSION="2.4.0.M3" + +# Set variables and locales +ENV \ + APPDIR="/openhab" \ + EXTRA_JAVA_OPTS="" \ + OPENHAB_HTTP_PORT="8080" \ + OPENHAB_HTTPS_PORT="8443" \ + LC_ALL="en_US.UTF-8" \ + LANG="en_US.UTF-8" \ + LANGUAGE="en_US.UTF-8" \ + CRYPTO_POLICY="limited" + +# Set arguments on build +ARG BUILD_DATE +ARG VCS_REF +ARG VERSION + +# Basic build-time metadata as defined at http://label-schema.org +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.docker.dockerfile="/Dockerfile" \ + org.label-schema.license="EPL" \ + org.label-schema.name="openHAB" \ + org.label-schema.vendor="openHAB Foundation e.V." \ + org.label-schema.version=$VERSION \ + org.label-schema.description="An open source, technology agnostic home automation platform" \ + org.label-schema.url="https://www.openhab.com/" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-type="Git" \ + org.label-schema.vcs-url="https://github.com/openhab/openhab-docker.git" \ + maintainer="openHAB " + +# Install basepackages +RUN apk upgrade --no-cache && \ + apk add --no-cache --virtual build-dependencies dpkg gnupg && \ + apk add --no-cache \ + arping \ + bash \ + ca-certificates \ + fontconfig \ + libpcap-dev \ + shadow \ + su-exec \ + ttf-dejavu \ + openjdk8 \ + unzip \ + wget \ + zip && \ + chmod u+s /usr/sbin/arping + +# Limit OpenJDK crypto policy by default to comply with local laws which may prohibit use of unlimited strength cryptography +ENV JAVA_HOME='/usr/lib/jvm/java-1.8-openjdk' +RUN rm -r "$JAVA_HOME/jre/lib/security/policy/unlimited" && \ + sed -i 's/^crypto.policy=unlimited/crypto.policy=limited/' "$JAVA_HOME/jre/lib/security/java.security" + +# Install openhab +# Set permissions for openhab. Export TERM variable. See issue #30 for details! +RUN wget -nv -O /tmp/openhab.zip "${OPENHAB_URL}" && \ + unzip -q /tmp/openhab.zip -d "${APPDIR}" && \ + rm /tmp/openhab.zip && \ + mkdir -p "${APPDIR}/userdata/logs" && \ + touch "${APPDIR}/userdata/logs/openhab.log" && \ + cp -a "${APPDIR}/userdata" "${APPDIR}/userdata.dist" && \ + cp -a "${APPDIR}/conf" "${APPDIR}/conf.dist" && \ + echo "export TERM=dumb" | tee -a ~/.bashrc + +# Expose volume with configuration and userdata dir +VOLUME ${APPDIR}/conf ${APPDIR}/userdata ${APPDIR}/addons + +# Reduce image size by removing files that are used only for building the image +RUN apk del build-dependencies && \ + rm -rf /var/cache/apk/* + +# Expose HTTP, HTTPS, Console and LSP ports +EXPOSE 8080 8443 8101 5007 + +# Set working directory and entrypoint +WORKDIR ${APPDIR} +COPY entrypoint.sh / +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + +# Execute command +CMD ["su-exec", "openhab", "./start.sh"] diff --git a/2.4.0.M3/armhf/alpine/entrypoint.sh b/2.4.0.M3/armhf/alpine/entrypoint.sh new file mode 100644 index 0000000..bd72a07 --- /dev/null +++ b/2.4.0.M3/armhf/alpine/entrypoint.sh @@ -0,0 +1,121 @@ +#!/bin/bash -x + +interactive=$(if test -t 0; then echo true; else echo false; fi) +set -euo pipefail +IFS=$'\n\t' + +# Install Java unlimited strength cryptography +if [ "${CRYPTO_POLICY}" = "unlimited" ] && [ ! -d "${JAVA_HOME}/jre/lib/security/policy/unlimited" ]; then + echo "Installing OpenJDK unlimited strength cryptography policy..." + apk fix --no-cache openjdk8-jre-lib +fi + +# Deleting instance.properties to avoid karaf PID conflict on restart +# See: https://github.com/openhab/openhab-docker/issues/99 +rm -f /openhab/runtime/instances/instance.properties + +# The instance.properties file in OH2.x is installed in the tmp +# directory +rm -f /openhab/userdata/tmp/instances/instance.properties + +# Add openhab user & handle possible device groups for different host systems +# Container base image puts dialout on group id 20, uucp on id 14 +# GPIO Group for RPI access +NEW_USER_ID=${USER_ID:-9001} +NEW_GROUP_ID=${GROUP_ID:-$NEW_USER_ID} +echo "Starting with openhab user id: $NEW_USER_ID and group id: $NEW_GROUP_ID" +if ! id -u openhab >/dev/null 2>&1; then + echo "Create group openhab with id ${NEW_GROUP_ID}" + addgroup -g $NEW_GROUP_ID openhab + echo "Create user openhab with id ${NEW_USER_ID}" + adduser -u $NEW_USER_ID -D -g '' -h ${APPDIR} -G openhab openhab + adduser openhab dialout + adduser openhab uucp +fi + +# Copy initial files to host volume +case ${OPENHAB_VERSION} in + 1.8.3) + if [ -z "$(ls -A "${APPDIR}/configurations")" ]; then + # Copy userdata dir for version 1.8.3 + echo "No configuration found... initializing." + cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" + fi + ;; + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) + # Initialize empty host volumes + if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No userdata found... initializing." + cp -av "${APPDIR}/userdata.dist/." "${APPDIR}/userdata/" + fi + + # Upgrade userdata if versions do not match + if [ ! -z $(cmp "${APPDIR}/userdata/etc/version.properties" "${APPDIR}/userdata.dist/etc/version.properties") ]; then + echo "Image and userdata versions differ! Starting an upgrade." + + # Make a backup of userdata + backupFile=userdata-$(date +"%FT%H-%M-%S").tar + if [ ! -d "${APPDIR}/userdata/backup" ]; then + mkdir "${APPDIR}/userdata/backup" + fi + tar -c -f "${APPDIR}/userdata/backup/${backupFile}" --exclude "backup/*" "${APPDIR}/userdata" + echo "You can find backup of userdata in ${APPDIR}/userdata/backup/${backupFile}" + + # Copy over the updated files + cp "${APPDIR}/userdata.dist/etc/all.policy" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding-ssh.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/config.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/custom.properties" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/custom.system.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/custom.system.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/distribution.info" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/jre.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.apache.karaf"* "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.ops4j.pax.url.mvn.cfg" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/overrides.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/profile.cfg" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/startup.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/system.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/version.properties" "${APPDIR}/userdata/etc/" + echo "Replaced files in userdata/etc with newer versions" + + # Remove necessary files after installation + rm -rf "${APPDIR}/userdata/etc/org.openhab.addons.cfg" + if [ ! -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + rm -rf "${APPDIR}/userdata/etc/overrides.properties" + fi + + # Clear the cache and tmp + rm -rf "${APPDIR}/userdata/cache" + rm -rf "${APPDIR}/userdata/tmp" + mkdir "${APPDIR}/userdata/cache" + mkdir "${APPDIR}/userdata/tmp" + echo "Cleared the cache and tmp" + fi + + if [ -z "$(ls -A "${APPDIR}/conf")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No configuration found... initializing." + cp -av "${APPDIR}/conf.dist/." "${APPDIR}/conf/" + fi + ;; + *) + echo openHAB version ${OPENHAB_VERSION} not supported! + ;; +esac + +# Set openhab folder permission +chown -R openhab:openhab ${APPDIR} + +# Use server mode with the default command when there is no pseudo-TTY +if [ "$interactive" == "false" ] && [ "$(IFS=" "; echo "$@")" == "su-exec openhab ./start.sh" ]; then + command=($@ server) + exec "${command[@]}" +else + exec "$@" +fi diff --git a/2.4.0.M3/armhf/debian/Dockerfile b/2.4.0.M3/armhf/debian/Dockerfile new file mode 100644 index 0000000..f205397 --- /dev/null +++ b/2.4.0.M3/armhf/debian/Dockerfile @@ -0,0 +1,104 @@ +# openhab image +# +# ------------------------------------------------------------------------------ +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# ------------------------------------------------------------------------------ +# +FROM multiarch/debian-debootstrap:armhf-stretch + +# Set download urls +ENV \ + JAVA_URL="https://www.azul.com/downloads/zulu/zdk-8-ga-linux_aarch32hf.tar.gz" \ + OPENHAB_URL="https://openhab.jfrog.io/openhab/libs-milestone-local/org/openhab/distro/openhab/2.4.0.M3/openhab-2.4.0.M3.zip" \ + OPENHAB_VERSION="2.4.0.M3" + +# Set variables and locales +ENV \ + APPDIR="/openhab" \ + EXTRA_JAVA_OPTS="" \ + OPENHAB_HTTP_PORT="8080" \ + OPENHAB_HTTPS_PORT="8443" \ + LC_ALL="en_US.UTF-8" \ + LANG="en_US.UTF-8" \ + LANGUAGE="en_US.UTF-8" \ + CRYPTO_POLICY="limited" + +# Set arguments on build +ARG BUILD_DATE +ARG VCS_REF +ARG VERSION + +# Basic build-time metadata as defined at http://label-schema.org +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.docker.dockerfile="/Dockerfile" \ + org.label-schema.license="EPL" \ + org.label-schema.name="openHAB" \ + org.label-schema.vendor="openHAB Foundation e.V." \ + org.label-schema.version=$VERSION \ + org.label-schema.description="An open source, technology agnostic home automation platform" \ + org.label-schema.url="https://www.openhab.com/" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-type="Git" \ + org.label-schema.vcs-url="https://github.com/openhab/openhab-docker.git" \ + maintainer="openHAB " + +# Install basepackages +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ + arping \ + ca-certificates \ + dirmngr \ + fontconfig \ + gnupg \ + gosu \ + libpcap-dev \ + locales \ + locales-all \ + netbase \ + unzip \ + wget \ + zip && \ + chmod u+s /usr/sbin/arping && \ + ln -s -f /bin/true /usr/bin/chfn + +# Install java +ENV JAVA_HOME='/usr/lib/java-8' +RUN wget -nv -O /tmp/java.tar.gz "${JAVA_URL}" && \ + mkdir "${JAVA_HOME}" && \ + tar --exclude='demo' --exclude='sample' --exclude='src.zip' -xvf /tmp/java.tar.gz --strip-components=1 -C "${JAVA_HOME}" && \ + rm /tmp/java.tar.gz && \ + update-alternatives --install /usr/bin/java java "${JAVA_HOME}/bin/java" 50 && \ + update-alternatives --install /usr/bin/javac javac "${JAVA_HOME}/bin/javac" 50 + +# Install openhab +# Set permissions for openhab. Export TERM variable. See issue #30 for details! +RUN wget -nv -O /tmp/openhab.zip "${OPENHAB_URL}" && \ + unzip -q /tmp/openhab.zip -d "${APPDIR}" && \ + rm /tmp/openhab.zip && \ + mkdir -p "${APPDIR}/userdata/logs" && \ + touch "${APPDIR}/userdata/logs/openhab.log" && \ + cp -a "${APPDIR}/userdata" "${APPDIR}/userdata.dist" && \ + cp -a "${APPDIR}/conf" "${APPDIR}/conf.dist" && \ + echo "export TERM=dumb" | tee -a ~/.bashrc + +# Expose volume with configuration and userdata dir +VOLUME ${APPDIR}/conf ${APPDIR}/userdata ${APPDIR}/addons + +# Reduce image size by removing files that are used only for building the image +RUN DEBIAN_FRONTEND=noninteractive apt-get remove -y dirmngr gnupg && \ + DEBIAN_FRONTEND=noninteractive apt-get autoremove -y && \ + rm -rf /var/lib/apt/lists/* + +# Expose HTTP, HTTPS, Console and LSP ports +EXPOSE 8080 8443 8101 5007 + +# Set working directory and entrypoint +WORKDIR ${APPDIR} +COPY entrypoint.sh / +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + +# Execute command +CMD ["gosu", "openhab", "./start.sh"] diff --git a/2.4.0.M3/armhf/debian/entrypoint.sh b/2.4.0.M3/armhf/debian/entrypoint.sh new file mode 100644 index 0000000..d058008 --- /dev/null +++ b/2.4.0.M3/armhf/debian/entrypoint.sh @@ -0,0 +1,133 @@ +#!/bin/bash -x + +interactive=$(if test -t 0; then echo true; else echo false; fi) +set -euo pipefail +IFS=$'\n\t' + +# Install Java unlimited strength cryptography +if [ "${CRYPTO_POLICY}" = "unlimited" ] && [ ! -f "${JAVA_HOME}/jre/lib/security/README.txt" ]; then + echo "Installing Zulu Cryptography Extension Kit (\"CEK\")..." + wget -q -O /tmp/ZuluJCEPolicies.zip https://cdn.azul.com/zcek/bin/ZuluJCEPolicies.zip + unzip -jo -d ${JAVA_HOME}/jre/lib/security /tmp/ZuluJCEPolicies.zip + rm /tmp/ZuluJCEPolicies.zip +fi + +# Deleting instance.properties to avoid karaf PID conflict on restart +# See: https://github.com/openhab/openhab-docker/issues/99 +rm -f /openhab/runtime/instances/instance.properties + +# The instance.properties file in OH2.x is installed in the tmp +# directory +rm -f /openhab/userdata/tmp/instances/instance.properties + +# Add openhab user & handle possible device groups for different host systems +# Container base image puts dialout on group id 20, uucp on id 10 +# GPIO Group for RPI access +NEW_USER_ID=${USER_ID:-9001} +NEW_GROUP_ID=${GROUP_ID:-$NEW_USER_ID} +echo "Starting with openhab user id: $NEW_USER_ID and group id: $NEW_GROUP_ID" +if ! id -u openhab >/dev/null 2>&1; then + echo "Create group openhab with id ${NEW_GROUP_ID}" + groupadd -g $NEW_GROUP_ID openhab + echo "Create user openhab with id ${NEW_USER_ID}" + adduser -u $NEW_USER_ID --disabled-password --gecos '' --home ${APPDIR} --gid $NEW_GROUP_ID openhab + groupadd -g 14 uucp2 + groupadd -g 16 dialout2 + groupadd -g 18 dialout3 + groupadd -g 32 uucp3 + groupadd -g 997 gpio + adduser openhab dialout + adduser openhab uucp + adduser openhab uucp2 + adduser openhab dialout2 + adduser openhab dialout3 + adduser openhab uucp3 + adduser openhab gpio +fi + +# Copy initial files to host volume +case ${OPENHAB_VERSION} in + 1.8.3) + if [ -z "$(ls -A "${APPDIR}/configurations")" ]; then + # Copy userdata dir for version 1.8.3 + echo "No configuration found... initializing." + cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" + fi + ;; + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) + # Initialize empty host volumes + if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No userdata found... initializing." + cp -av "${APPDIR}/userdata.dist/." "${APPDIR}/userdata/" + fi + + # Upgrade userdata if versions do not match + if [ ! -z $(cmp "${APPDIR}/userdata/etc/version.properties" "${APPDIR}/userdata.dist/etc/version.properties") ]; then + echo "Image and userdata versions differ! Starting an upgrade." + + # Make a backup of userdata + backupFile=userdata-$(date +"%FT%H-%M-%S").tar + if [ ! -d "${APPDIR}/userdata/backup" ]; then + mkdir "${APPDIR}/userdata/backup" + fi + tar --exclude="${APPDIR}/userdata/backup" -c -f "${APPDIR}/userdata/backup/${backupFile}" "${APPDIR}/userdata" + echo "You can find backup of userdata in ${APPDIR}/userdata/backup/${backupFile}" + + # Copy over the updated files + cp "${APPDIR}/userdata.dist/etc/all.policy" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding-ssh.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/config.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/custom.properties" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/custom.system.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/custom.system.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/distribution.info" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/jre.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.apache.karaf"* "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.ops4j.pax.url.mvn.cfg" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/overrides.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/profile.cfg" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/startup.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/system.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/version.properties" "${APPDIR}/userdata/etc/" + echo "Replaced files in userdata/etc with newer versions" + + # Remove necessary files after installation + rm -rf "${APPDIR}/userdata/etc/org.openhab.addons.cfg" + if [ ! -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + rm -rf "${APPDIR}/userdata/etc/overrides.properties" + fi + + # Clear the cache and tmp + rm -rf "${APPDIR}/userdata/cache" + rm -rf "${APPDIR}/userdata/tmp" + mkdir "${APPDIR}/userdata/cache" + mkdir "${APPDIR}/userdata/tmp" + echo "Cleared the cache and tmp" + fi + + if [ -z "$(ls -A "${APPDIR}/conf")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No configuration found... initializing." + cp -av "${APPDIR}/conf.dist/." "${APPDIR}/conf/" + fi + ;; + *) + echo openHAB version ${OPENHAB_VERSION} not supported! + ;; +esac + +# Set openhab folder permission +chown -R openhab:openhab ${APPDIR} + +# Use server mode with the default command when there is no pseudo-TTY +if [ "$interactive" == "false" ] && [ "$(IFS=" "; echo "$@")" == "gosu openhab ./start.sh" ]; then + command=($@ server) + exec "${command[@]}" +else + exec "$@" +fi diff --git a/2.4.0.M3/i386/alpine/Dockerfile b/2.4.0.M3/i386/alpine/Dockerfile new file mode 100644 index 0000000..e009c51 --- /dev/null +++ b/2.4.0.M3/i386/alpine/Dockerfile @@ -0,0 +1,98 @@ +# openhab image +# +# ------------------------------------------------------------------------------ +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# ------------------------------------------------------------------------------ +# +FROM multiarch/alpine:i386-v3.8 + +# Set download urls +ENV \ + JAVA_URL="https://www.azul.com/downloads/zulu/zdk-8-ga-linux_x64.tar.gz" \ + OPENHAB_URL="https://openhab.jfrog.io/openhab/libs-milestone-local/org/openhab/distro/openhab/2.4.0.M3/openhab-2.4.0.M3.zip" \ + OPENHAB_VERSION="2.4.0.M3" + +# Set variables and locales +ENV \ + APPDIR="/openhab" \ + EXTRA_JAVA_OPTS="" \ + OPENHAB_HTTP_PORT="8080" \ + OPENHAB_HTTPS_PORT="8443" \ + LC_ALL="en_US.UTF-8" \ + LANG="en_US.UTF-8" \ + LANGUAGE="en_US.UTF-8" \ + CRYPTO_POLICY="limited" + +# Set arguments on build +ARG BUILD_DATE +ARG VCS_REF +ARG VERSION + +# Basic build-time metadata as defined at http://label-schema.org +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.docker.dockerfile="/Dockerfile" \ + org.label-schema.license="EPL" \ + org.label-schema.name="openHAB" \ + org.label-schema.vendor="openHAB Foundation e.V." \ + org.label-schema.version=$VERSION \ + org.label-schema.description="An open source, technology agnostic home automation platform" \ + org.label-schema.url="https://www.openhab.com/" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-type="Git" \ + org.label-schema.vcs-url="https://github.com/openhab/openhab-docker.git" \ + maintainer="openHAB " + +# Install basepackages +RUN apk upgrade --no-cache && \ + apk add --no-cache --virtual build-dependencies dpkg gnupg && \ + apk add --no-cache \ + arping \ + bash \ + ca-certificates \ + fontconfig \ + libpcap-dev \ + shadow \ + su-exec \ + ttf-dejavu \ + openjdk8 \ + unzip \ + wget \ + zip && \ + chmod u+s /usr/sbin/arping + +# Limit OpenJDK crypto policy by default to comply with local laws which may prohibit use of unlimited strength cryptography +ENV JAVA_HOME='/usr/lib/jvm/java-1.8-openjdk' +RUN rm -r "$JAVA_HOME/jre/lib/security/policy/unlimited" && \ + sed -i 's/^crypto.policy=unlimited/crypto.policy=limited/' "$JAVA_HOME/jre/lib/security/java.security" + +# Install openhab +# Set permissions for openhab. Export TERM variable. See issue #30 for details! +RUN wget -nv -O /tmp/openhab.zip "${OPENHAB_URL}" && \ + unzip -q /tmp/openhab.zip -d "${APPDIR}" && \ + rm /tmp/openhab.zip && \ + mkdir -p "${APPDIR}/userdata/logs" && \ + touch "${APPDIR}/userdata/logs/openhab.log" && \ + cp -a "${APPDIR}/userdata" "${APPDIR}/userdata.dist" && \ + cp -a "${APPDIR}/conf" "${APPDIR}/conf.dist" && \ + echo "export TERM=dumb" | tee -a ~/.bashrc + +# Expose volume with configuration and userdata dir +VOLUME ${APPDIR}/conf ${APPDIR}/userdata ${APPDIR}/addons + +# Reduce image size by removing files that are used only for building the image +RUN apk del build-dependencies && \ + rm -rf /var/cache/apk/* + +# Expose HTTP, HTTPS, Console and LSP ports +EXPOSE 8080 8443 8101 5007 + +# Set working directory and entrypoint +WORKDIR ${APPDIR} +COPY entrypoint.sh / +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + +# Execute command +CMD ["su-exec", "openhab", "./start.sh"] diff --git a/2.4.0.M3/i386/alpine/entrypoint.sh b/2.4.0.M3/i386/alpine/entrypoint.sh new file mode 100644 index 0000000..bd72a07 --- /dev/null +++ b/2.4.0.M3/i386/alpine/entrypoint.sh @@ -0,0 +1,121 @@ +#!/bin/bash -x + +interactive=$(if test -t 0; then echo true; else echo false; fi) +set -euo pipefail +IFS=$'\n\t' + +# Install Java unlimited strength cryptography +if [ "${CRYPTO_POLICY}" = "unlimited" ] && [ ! -d "${JAVA_HOME}/jre/lib/security/policy/unlimited" ]; then + echo "Installing OpenJDK unlimited strength cryptography policy..." + apk fix --no-cache openjdk8-jre-lib +fi + +# Deleting instance.properties to avoid karaf PID conflict on restart +# See: https://github.com/openhab/openhab-docker/issues/99 +rm -f /openhab/runtime/instances/instance.properties + +# The instance.properties file in OH2.x is installed in the tmp +# directory +rm -f /openhab/userdata/tmp/instances/instance.properties + +# Add openhab user & handle possible device groups for different host systems +# Container base image puts dialout on group id 20, uucp on id 14 +# GPIO Group for RPI access +NEW_USER_ID=${USER_ID:-9001} +NEW_GROUP_ID=${GROUP_ID:-$NEW_USER_ID} +echo "Starting with openhab user id: $NEW_USER_ID and group id: $NEW_GROUP_ID" +if ! id -u openhab >/dev/null 2>&1; then + echo "Create group openhab with id ${NEW_GROUP_ID}" + addgroup -g $NEW_GROUP_ID openhab + echo "Create user openhab with id ${NEW_USER_ID}" + adduser -u $NEW_USER_ID -D -g '' -h ${APPDIR} -G openhab openhab + adduser openhab dialout + adduser openhab uucp +fi + +# Copy initial files to host volume +case ${OPENHAB_VERSION} in + 1.8.3) + if [ -z "$(ls -A "${APPDIR}/configurations")" ]; then + # Copy userdata dir for version 1.8.3 + echo "No configuration found... initializing." + cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" + fi + ;; + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) + # Initialize empty host volumes + if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No userdata found... initializing." + cp -av "${APPDIR}/userdata.dist/." "${APPDIR}/userdata/" + fi + + # Upgrade userdata if versions do not match + if [ ! -z $(cmp "${APPDIR}/userdata/etc/version.properties" "${APPDIR}/userdata.dist/etc/version.properties") ]; then + echo "Image and userdata versions differ! Starting an upgrade." + + # Make a backup of userdata + backupFile=userdata-$(date +"%FT%H-%M-%S").tar + if [ ! -d "${APPDIR}/userdata/backup" ]; then + mkdir "${APPDIR}/userdata/backup" + fi + tar -c -f "${APPDIR}/userdata/backup/${backupFile}" --exclude "backup/*" "${APPDIR}/userdata" + echo "You can find backup of userdata in ${APPDIR}/userdata/backup/${backupFile}" + + # Copy over the updated files + cp "${APPDIR}/userdata.dist/etc/all.policy" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding-ssh.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/config.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/custom.properties" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/custom.system.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/custom.system.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/distribution.info" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/jre.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.apache.karaf"* "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.ops4j.pax.url.mvn.cfg" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/overrides.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/profile.cfg" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/startup.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/system.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/version.properties" "${APPDIR}/userdata/etc/" + echo "Replaced files in userdata/etc with newer versions" + + # Remove necessary files after installation + rm -rf "${APPDIR}/userdata/etc/org.openhab.addons.cfg" + if [ ! -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + rm -rf "${APPDIR}/userdata/etc/overrides.properties" + fi + + # Clear the cache and tmp + rm -rf "${APPDIR}/userdata/cache" + rm -rf "${APPDIR}/userdata/tmp" + mkdir "${APPDIR}/userdata/cache" + mkdir "${APPDIR}/userdata/tmp" + echo "Cleared the cache and tmp" + fi + + if [ -z "$(ls -A "${APPDIR}/conf")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No configuration found... initializing." + cp -av "${APPDIR}/conf.dist/." "${APPDIR}/conf/" + fi + ;; + *) + echo openHAB version ${OPENHAB_VERSION} not supported! + ;; +esac + +# Set openhab folder permission +chown -R openhab:openhab ${APPDIR} + +# Use server mode with the default command when there is no pseudo-TTY +if [ "$interactive" == "false" ] && [ "$(IFS=" "; echo "$@")" == "su-exec openhab ./start.sh" ]; then + command=($@ server) + exec "${command[@]}" +else + exec "$@" +fi diff --git a/2.4.0.M3/i386/debian/Dockerfile b/2.4.0.M3/i386/debian/Dockerfile new file mode 100644 index 0000000..739f81c --- /dev/null +++ b/2.4.0.M3/i386/debian/Dockerfile @@ -0,0 +1,104 @@ +# openhab image +# +# ------------------------------------------------------------------------------ +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# ------------------------------------------------------------------------------ +# +FROM multiarch/debian-debootstrap:i386-stretch + +# Set download urls +ENV \ + JAVA_URL="https://www.azul.com/downloads/zulu/zdk-8-ga-linux_x64.tar.gz" \ + OPENHAB_URL="https://openhab.jfrog.io/openhab/libs-milestone-local/org/openhab/distro/openhab/2.4.0.M3/openhab-2.4.0.M3.zip" \ + OPENHAB_VERSION="2.4.0.M3" + +# Set variables and locales +ENV \ + APPDIR="/openhab" \ + EXTRA_JAVA_OPTS="" \ + OPENHAB_HTTP_PORT="8080" \ + OPENHAB_HTTPS_PORT="8443" \ + LC_ALL="en_US.UTF-8" \ + LANG="en_US.UTF-8" \ + LANGUAGE="en_US.UTF-8" \ + CRYPTO_POLICY="limited" + +# Set arguments on build +ARG BUILD_DATE +ARG VCS_REF +ARG VERSION + +# Basic build-time metadata as defined at http://label-schema.org +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.docker.dockerfile="/Dockerfile" \ + org.label-schema.license="EPL" \ + org.label-schema.name="openHAB" \ + org.label-schema.vendor="openHAB Foundation e.V." \ + org.label-schema.version=$VERSION \ + org.label-schema.description="An open source, technology agnostic home automation platform" \ + org.label-schema.url="https://www.openhab.com/" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-type="Git" \ + org.label-schema.vcs-url="https://github.com/openhab/openhab-docker.git" \ + maintainer="openHAB " + +# Install basepackages +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ + arping \ + ca-certificates \ + dirmngr \ + fontconfig \ + gnupg \ + gosu \ + libpcap-dev \ + locales \ + locales-all \ + netbase \ + unzip \ + wget \ + zip && \ + chmod u+s /usr/sbin/arping && \ + ln -s -f /bin/true /usr/bin/chfn + +# Install java +ENV JAVA_HOME='/usr/lib/java-8' +RUN wget -nv -O /tmp/java.tar.gz "${JAVA_URL}" && \ + mkdir "${JAVA_HOME}" && \ + tar --exclude='demo' --exclude='sample' --exclude='src.zip' -xvf /tmp/java.tar.gz --strip-components=1 -C "${JAVA_HOME}" && \ + rm /tmp/java.tar.gz && \ + update-alternatives --install /usr/bin/java java "${JAVA_HOME}/bin/java" 50 && \ + update-alternatives --install /usr/bin/javac javac "${JAVA_HOME}/bin/javac" 50 + +# Install openhab +# Set permissions for openhab. Export TERM variable. See issue #30 for details! +RUN wget -nv -O /tmp/openhab.zip "${OPENHAB_URL}" && \ + unzip -q /tmp/openhab.zip -d "${APPDIR}" && \ + rm /tmp/openhab.zip && \ + mkdir -p "${APPDIR}/userdata/logs" && \ + touch "${APPDIR}/userdata/logs/openhab.log" && \ + cp -a "${APPDIR}/userdata" "${APPDIR}/userdata.dist" && \ + cp -a "${APPDIR}/conf" "${APPDIR}/conf.dist" && \ + echo "export TERM=dumb" | tee -a ~/.bashrc + +# Expose volume with configuration and userdata dir +VOLUME ${APPDIR}/conf ${APPDIR}/userdata ${APPDIR}/addons + +# Reduce image size by removing files that are used only for building the image +RUN DEBIAN_FRONTEND=noninteractive apt-get remove -y dirmngr gnupg && \ + DEBIAN_FRONTEND=noninteractive apt-get autoremove -y && \ + rm -rf /var/lib/apt/lists/* + +# Expose HTTP, HTTPS, Console and LSP ports +EXPOSE 8080 8443 8101 5007 + +# Set working directory and entrypoint +WORKDIR ${APPDIR} +COPY entrypoint.sh / +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + +# Execute command +CMD ["gosu", "openhab", "./start.sh"] diff --git a/2.4.0.M3/i386/debian/entrypoint.sh b/2.4.0.M3/i386/debian/entrypoint.sh new file mode 100644 index 0000000..d058008 --- /dev/null +++ b/2.4.0.M3/i386/debian/entrypoint.sh @@ -0,0 +1,133 @@ +#!/bin/bash -x + +interactive=$(if test -t 0; then echo true; else echo false; fi) +set -euo pipefail +IFS=$'\n\t' + +# Install Java unlimited strength cryptography +if [ "${CRYPTO_POLICY}" = "unlimited" ] && [ ! -f "${JAVA_HOME}/jre/lib/security/README.txt" ]; then + echo "Installing Zulu Cryptography Extension Kit (\"CEK\")..." + wget -q -O /tmp/ZuluJCEPolicies.zip https://cdn.azul.com/zcek/bin/ZuluJCEPolicies.zip + unzip -jo -d ${JAVA_HOME}/jre/lib/security /tmp/ZuluJCEPolicies.zip + rm /tmp/ZuluJCEPolicies.zip +fi + +# Deleting instance.properties to avoid karaf PID conflict on restart +# See: https://github.com/openhab/openhab-docker/issues/99 +rm -f /openhab/runtime/instances/instance.properties + +# The instance.properties file in OH2.x is installed in the tmp +# directory +rm -f /openhab/userdata/tmp/instances/instance.properties + +# Add openhab user & handle possible device groups for different host systems +# Container base image puts dialout on group id 20, uucp on id 10 +# GPIO Group for RPI access +NEW_USER_ID=${USER_ID:-9001} +NEW_GROUP_ID=${GROUP_ID:-$NEW_USER_ID} +echo "Starting with openhab user id: $NEW_USER_ID and group id: $NEW_GROUP_ID" +if ! id -u openhab >/dev/null 2>&1; then + echo "Create group openhab with id ${NEW_GROUP_ID}" + groupadd -g $NEW_GROUP_ID openhab + echo "Create user openhab with id ${NEW_USER_ID}" + adduser -u $NEW_USER_ID --disabled-password --gecos '' --home ${APPDIR} --gid $NEW_GROUP_ID openhab + groupadd -g 14 uucp2 + groupadd -g 16 dialout2 + groupadd -g 18 dialout3 + groupadd -g 32 uucp3 + groupadd -g 997 gpio + adduser openhab dialout + adduser openhab uucp + adduser openhab uucp2 + adduser openhab dialout2 + adduser openhab dialout3 + adduser openhab uucp3 + adduser openhab gpio +fi + +# Copy initial files to host volume +case ${OPENHAB_VERSION} in + 1.8.3) + if [ -z "$(ls -A "${APPDIR}/configurations")" ]; then + # Copy userdata dir for version 1.8.3 + echo "No configuration found... initializing." + cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" + fi + ;; + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) + # Initialize empty host volumes + if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No userdata found... initializing." + cp -av "${APPDIR}/userdata.dist/." "${APPDIR}/userdata/" + fi + + # Upgrade userdata if versions do not match + if [ ! -z $(cmp "${APPDIR}/userdata/etc/version.properties" "${APPDIR}/userdata.dist/etc/version.properties") ]; then + echo "Image and userdata versions differ! Starting an upgrade." + + # Make a backup of userdata + backupFile=userdata-$(date +"%FT%H-%M-%S").tar + if [ ! -d "${APPDIR}/userdata/backup" ]; then + mkdir "${APPDIR}/userdata/backup" + fi + tar --exclude="${APPDIR}/userdata/backup" -c -f "${APPDIR}/userdata/backup/${backupFile}" "${APPDIR}/userdata" + echo "You can find backup of userdata in ${APPDIR}/userdata/backup/${backupFile}" + + # Copy over the updated files + cp "${APPDIR}/userdata.dist/etc/all.policy" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/branding-ssh.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/config.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/custom.properties" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/custom.system.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/custom.system.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/distribution.info" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/jre.properties" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.apache.karaf"* "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/org.ops4j.pax.url.mvn.cfg" "${APPDIR}/userdata/etc/" + if [ -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + cp "${APPDIR}/userdata.dist/etc/overrides.properties" "${APPDIR}/userdata/etc/" + fi + cp "${APPDIR}/userdata.dist/etc/profile.cfg" "${APPDIR}/userdata/etc/" + cp "${APPDIR}/userdata.dist/etc/startup.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/system.properties" "${APPDIR}/userdata/etc" + cp "${APPDIR}/userdata.dist/etc/version.properties" "${APPDIR}/userdata/etc/" + echo "Replaced files in userdata/etc with newer versions" + + # Remove necessary files after installation + rm -rf "${APPDIR}/userdata/etc/org.openhab.addons.cfg" + if [ ! -f "${APPDIR}/userdata.dist/etc/overrides.properties" ]; then + rm -rf "${APPDIR}/userdata/etc/overrides.properties" + fi + + # Clear the cache and tmp + rm -rf "${APPDIR}/userdata/cache" + rm -rf "${APPDIR}/userdata/tmp" + mkdir "${APPDIR}/userdata/cache" + mkdir "${APPDIR}/userdata/tmp" + echo "Cleared the cache and tmp" + fi + + if [ -z "$(ls -A "${APPDIR}/conf")" ]; then + # Copy userdata dir for version 2.0.0 + echo "No configuration found... initializing." + cp -av "${APPDIR}/conf.dist/." "${APPDIR}/conf/" + fi + ;; + *) + echo openHAB version ${OPENHAB_VERSION} not supported! + ;; +esac + +# Set openhab folder permission +chown -R openhab:openhab ${APPDIR} + +# Use server mode with the default command when there is no pseudo-TTY +if [ "$interactive" == "false" ] && [ "$(IFS=" "; echo "$@")" == "gosu openhab ./start.sh" ]; then + command=($@ server) + exec "${command[@]}" +else + exec "$@" +fi diff --git a/README.md b/README.md index 6fe42e6..178dabe 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,8 @@ Comments, suggestions and contributions are welcome! * [`2.1.0` Stable openHAB 2.1 version](https://github.com/openhab/openhab-docker/blob/master/2.1.0/amd64/debian/Dockerfile) * [`2.2.0` Stable openHAB 2.2 version](https://github.com/openhab/openhab-docker/blob/master/2.2.0/amd64/debian/Dockerfile) * [`2.3.0` Stable openHAB 2.3 version](https://github.com/openhab/openhab-docker/blob/master/2.3.0/amd64/debian/Dockerfile) -* [`2.4.0-snapshot` Experimental openHAB 2.4 SNAPSHOT version](https://github.com/openhab/openhab-docker/blob/master/2.4.0-snapshot/amd64/debian/Dockerfile) +* [`2.4.0-snapshot` Experimental openHAB 2.4.0 SNAPSHOT version](https://github.com/openhab/openhab-docker/blob/master/2.4.0-snapshot/amd64/debian/Dockerfile) +* [`2.4.0.M3` Experimental openHAB 2.4.0.M3 stable Milestone version](https://github.com/openhab/openhab-docker/blob/master/2.4.0.M3/amd64/debian/Dockerfile) **Architecture:** diff --git a/entrypoint_alpine.sh b/entrypoint_alpine.sh index ba30c26..bd72a07 100755 --- a/entrypoint_alpine.sh +++ b/entrypoint_alpine.sh @@ -42,7 +42,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/entrypoint_debian.sh b/entrypoint_debian.sh index b320c1a..d058008 100755 --- a/entrypoint_debian.sh +++ b/entrypoint_debian.sh @@ -54,7 +54,7 @@ case ${OPENHAB_VERSION} in cp -av "${APPDIR}/configurations.dist/." "${APPDIR}/configurations/" fi ;; - 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot) + 2.0.0|2.1.0|2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) # Initialize empty host volumes if [ -z "$(ls -A "${APPDIR}/userdata")" ]; then # Copy userdata dir for version 2.0.0 diff --git a/update.sh b/update.sh index df63198..c8e5c49 100755 --- a/update.sh +++ b/update.sh @@ -2,7 +2,7 @@ set -eo pipefail # Dockerfiles to be generated -versions="2.4.0-snapshot 2.3.0 2.2.0 2.1.0 2.0.0 1.8.3" +versions="2.4.0.M3 2.4.0-snapshot 2.3.0 2.2.0 2.1.0 2.0.0 1.8.3" arches="i386 amd64 armhf arm64" bases="debian alpine" @@ -17,13 +17,16 @@ print_header() { # PLEASE DO NOT EDIT IT DIRECTLY. # ------------------------------------------------------------------------------ # - EOI +EOI } # Print selected image print_baseimage() { # Set download url for openhab version case $version in + 2.4.0.M3) + openhab_url="https://openhab.jfrog.io/openhab/libs-milestone-local/org/openhab/distro/openhab/2.4.0.M3/openhab-2.4.0.M3.zip" + ;; 2.4.0-snapshot) openhab_url="https://openhab.ci.cloudbees.com/job/openHAB-Distribution/lastSuccessfulBuild/artifact/distributions/openhab/target/openhab-2.4.0-SNAPSHOT.zip" ;; @@ -82,7 +85,7 @@ print_baseimage() { OPENHAB_URL="$openhab_url" \\ OPENHAB_VERSION="$version" - EOI +EOI } # Print metadata @@ -286,7 +289,7 @@ print_expose_ports() { expose_comment="Expose HTTP, HTTPS and Console ports" expose_ports="8080 8443 8101" ;; - 2.2.0|2.3.0|2.4.0-snapshot) + 2.2.0|2.3.0|2.4.0-snapshot|2.4.0.M3) expose_comment="Expose HTTP, HTTPS, Console and LSP ports" expose_ports="8080 8443 8101 5007" ;; @@ -300,7 +303,7 @@ print_expose_ports() { # $expose_comment EXPOSE $expose_ports - EOI +EOI } # Set working directory and entrypoint