Skip to content

Commit

Permalink
Add openHAB in Raspberry Imager (#1708)
Browse files Browse the repository at this point in the history
* Update template_rpi-imager-openhab.json
* cp json in build-action.yaml
* Update build-action.yml
* Update build.bash

Signed-off-by: Carsten Mogge <[email protected]>
  • Loading branch information
Larsen-Locke authored Aug 15, 2022
1 parent 8cfe86f commit be9d23e
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/build-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ jobs:
sed -i -e "s|^userpw=.*$|userpw=\"${{secrets.USERPW}}\"|g" build-image/openhabian.pi-raspios32.conf
sed -i -e "s|^userpw=.*$|userpw=\"${{secrets.USERPW}}\"|g" build-image/openhabian.pi-raspios64.conf
sed -i -e "s|ap_password:.*$|ap_password: ${{secrets.HOTSPOTPW}}|g" includes/comitup.conf
cp build-image/template_rpi-imager-openhab.json rpi-imager-openhab.json
sudo -E ./build.bash rpi
sudo -E ./build.bash rpi64
echo "::set-output name=image32::$(ls openhabian-pi-raspios32*.img.xz)"
echo "::set-output name=image64::$(ls openhabian-pi-raspios64*.img.xz)"
echo "::set-output name=json_image::$(ls rpi-imager-openhab.json)"
- name: Archive openHABian 32bit image
uses: actions/upload-artifact@v3
with:
Expand All @@ -71,6 +73,12 @@ jobs:
with:
name: ${{ steps.build.outputs.image64 }}
path: ${{ steps.build.outputs.image64 }}
- name: Archive openHABian json of image download
uses: actions/upload-artifact@v3
with:
name: ${{ steps.build.outputs.json_image }}
path: ${{ steps.build.outputs.json_image }}

- name: Create release template
if: ${{ success() && github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
uses: "marvinpinto/[email protected]"
Expand All @@ -83,3 +91,4 @@ jobs:
files: |
${{ steps.build.outputs.image32 }}
${{ steps.build.outputs.image64 }}
${{ steps.build.outputs.json_image }}
28 changes: 28 additions & 0 deletions build-image/template_rpi-imager-openhab.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"os_list": [
{
"name": "openHABian (Raspberry Pi OS lite 32 bit)",
"description": "Installation of openHAB\nClick the info icon for installation information.",
"url": "%url32%",
"icon": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMzIgMzIiPgoJPGNpcmNsZSBjeD0iMTYiIGN5PSIxNiIgcj0iMTYiIGZpbGw9IiNmZmYiLz4KCTxwYXRoIGZpbGw9IiNlNjRhMTkiIGQ9Im01LjI0MiAyMS4xMzMgOS4zOS05LjM5OEwxNiAxMC4zNjhsMS4zNjcgMS4zNjcgNi45MzMgNi45MzMtLjAxLjAzNS0uMTM3LjQwMi0uMTU2LjM5NC0uMTc0LjM4My0uMTkyLjM3NC0uMTc1LjMwNEwxNiAxMy4xMDMgNi4yNCAyMi44N2MtLjM3Ny0uNTUzLS43MjUtMS4xMjMtLjk5OC0xLjczOHoiLz4KCTxwYXRoIGZpbGw9IiM0NzQ3NDciIGQ9Ik0xNiA0YzYuNjEgMCAxMiA1LjM5IDEyIDEycy01LjM5IDEyLTEyIDEyYy0zLjYxIDAtNi44NTYtMS42MS05LjA1OS00LjE0N2wuNDI0LS40MjUuMzA4LS4zMDguMzA4LS4zMS4zMDktLjMwNy4wMTMtLjAxM0ExMC4wNTcgMTAuMDU3IDAgMCAwIDE2IDI2LjA3N2M1LjU1IDAgMTAuMDc4LTQuNTI2IDEwLjA3OC0xMC4wNzdTMjEuNTUgNS45MjIgMTYgNS45MjJDMTAuNDQ5IDUuOTIyIDUuOTIyIDEwLjQ1IDUuOTIyIDE2YzAgLjc0Ny4wODMgMS40NzYuMjM5IDIuMTc4bC0uNjY4LjY3LS44OTMuODkzQTExLjkyMiAxMS45MjIgMCAwIDEgNCAxNkM0IDkuMzkgOS4zOSA0IDE2IDR6Ii8+Cjwvc3ZnPgo=",
"extract_size": %imageE_size32%,
"extract_sha256": "%imageE_sha32%",
"release_date": "%release_date%",
"image_download_size": %imageZ_size32%,
"image_download_sha256": "%imageZ_sha32%",
"website": "https://www.openhab.org/docs/installation/openhabian.html#raspberry-pi-prepackaged-sd-card-image"
},
{
"name": "openHABian (Raspberry Pi OS lite 64 bit)",
"description": "Installation of openHAB\nClick the info icon for installation information.",
"url": "%url64%",
"icon": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMzIgMzIiPgoJPGNpcmNsZSBjeD0iMTYiIGN5PSIxNiIgcj0iMTYiIGZpbGw9IiNmZmYiLz4KCTxwYXRoIGZpbGw9IiNlNjRhMTkiIGQ9Im01LjI0MiAyMS4xMzMgOS4zOS05LjM5OEwxNiAxMC4zNjhsMS4zNjcgMS4zNjcgNi45MzMgNi45MzMtLjAxLjAzNS0uMTM3LjQwMi0uMTU2LjM5NC0uMTc0LjM4My0uMTkyLjM3NC0uMTc1LjMwNEwxNiAxMy4xMDMgNi4yNCAyMi44N2MtLjM3Ny0uNTUzLS43MjUtMS4xMjMtLjk5OC0xLjczOHoiLz4KCTxwYXRoIGZpbGw9IiM0NzQ3NDciIGQ9Ik0xNiA0YzYuNjEgMCAxMiA1LjM5IDEyIDEycy01LjM5IDEyLTEyIDEyYy0zLjYxIDAtNi44NTYtMS42MS05LjA1OS00LjE0N2wuNDI0LS40MjUuMzA4LS4zMDguMzA4LS4zMS4zMDktLjMwNy4wMTMtLjAxM0ExMC4wNTcgMTAuMDU3IDAgMCAwIDE2IDI2LjA3N2M1LjU1IDAgMTAuMDc4LTQuNTI2IDEwLjA3OC0xMC4wNzdTMjEuNTUgNS45MjIgMTYgNS45MjJDMTAuNDQ5IDUuOTIyIDUuOTIyIDEwLjQ1IDUuOTIyIDE2YzAgLjc0Ny4wODMgMS40NzYuMjM5IDIuMTc4bC0uNjY4LjY3LS44OTMuODkzQTExLjkyMiAxMS45MjIgMCAwIDEgNCAxNkM0IDkuMzkgOS4zOSA0IDE2IDR6Ii8+Cjwvc3ZnPgo=",
"extract_size": %imageE_size64%,
"extract_sha256": "%imageE_sha64%",
"release_date": "%release_date%",
"image_download_size": %imageZ_size64%,
"image_download_sha256": "%imageZ_sha64%",
"website": "https://www.openhab.org/docs/installation/openhabian.html#raspberry-pi-prepackaged-sd-card-image"
}
]
}
23 changes: 23 additions & 0 deletions build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,30 @@ xz --verbose --compress --keep -9 -T0 "$destination"
crc32checksum="$(crc32 "${destination}.xz")"
mv "${destination}.xz" "openhabian-${hwPlatform}-${timestamp}-git${shorthash}-crc${crc32checksum}.img.xz"

# generate json-file for integration in raspberry-imager
pathDownload="https://github.com/openhab/openhabian/releases/latest/download"
release_date=$(date "+%Y-%m-%d")
fileE="${destination}"
fileZ="openhabian-${hwPlatform}-${timestamp}-git${shorthash}-crc${crc32checksum}.img.xz"

imageE_size="$(stat -c %s "${fileE}")"
imageZ_size="$(stat -c %s "${fileZ}")"

echo_process "Computing SHA256 message digest of image... "
imageE_sha="$(sha256sum "${fileE}"| cut -d' ' -f1)"
imageZ_sha="$(sha256sum "${fileZ}"| cut -d' ' -f1)"

url="${pathDownload}/${fileZ}"

sed -i -e "s|%release_date%|${release_date}|g" rpi-imager-openhab.json
sed -i -e "s|%url${bits}%|${url}|g" rpi-imager-openhab.json
sed -i -e "s|%imageE_size${bits}%|${imageE_size}|g" rpi-imager-openhab.json
sed -i -e "s|%imageE_sha${bits}%|${imageE_sha}|g" rpi-imager-openhab.json
sed -i -e "s|%imageZ_size${bits}%|${imageZ_size}|g" rpi-imager-openhab.json
sed -i -e "s|%imageZ_sha${bits}%|${imageZ_sha}|g" rpi-imager-openhab.json

echo_process "Finished! The results:"
ls -alh "openhabian-${hwPlatform}-${timestamp}"*
ls -alh "rpi-imager-openhab.json"

# vim: filetype=sh

0 comments on commit be9d23e

Please sign in to comment.