Skip to content

Commit

Permalink
Merge pull request #11 from hardwario/bullseye-update
Browse files Browse the repository at this point in the history
Update to Bullseye
  • Loading branch information
SmejkalJakub committed Dec 6, 2022
2 parents fdec5db + a8e9028 commit 25c942d
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 66 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: main

on:
release:
types: [ published ]
workflow_dispatch:

env:
VERSION: ${GITHUB_REF##*/}

jobs:
build-lite:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3

- name: Setup env
run: |
echo "VERSION=${{env.VERSION}}" >> "$GITHUB_ENV"
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: kpartx coreutils qemu-user-static zip unzip binfmt-support openssl systemd-container parted xz-utils binfmt-support qemu-user-static

- name: Build Raspbian Lite
env:
NAME: hio-raspbian-bullseye-lite
URL: https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2022-09-26/2022-09-22-raspios-bullseye-armhf-lite.img.xz
SHA256: 9bf5234efbadd2d39769486e0a20923d8526a45eba57f74cda45ef78e2b628da
VERSION: ${{env.VERSION}}
run: |
sudo -E ./build.sh
- name: Release
if: ${{ github.event_name == 'release' }}
uses: softprops/action-gh-release@v0.1.5
env:
GITHUB_TOKEN: ${{ github.token }}
with:
files: |
hio-raspbian-bullseye-lite-${{env.VERSION}}.zip
hio-raspbian-bullseye-lite-grafana-influxdb-${{env.VERSION}}.zip
build-desktop:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3

- name: Setup env
run: |
echo "VERSION=${{env.VERSION}}" >> "$GITHUB_ENV"
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: kpartx coreutils qemu-user-static zip unzip binfmt-support openssl systemd-container parted xz-utils binfmt-support qemu-user-static

- name: Build Raspbian Desktop
env:
NAME: hio-raspbian-bullseye-desktop
URL: https://downloads.raspberrypi.org/raspios_armhf/images/raspios_armhf-2022-09-26/2022-09-22-raspios-bullseye-armhf.img.xz
SHA256: 4d8f38d014a807198996693b90cbeef94e19d9fd7fbefba7068db8df4d698cdd
VERSION: ${{env.VERSION}}
run: |
sudo -E ./build.sh
- name: Release
if: ${{ github.event_name == 'release' }}
uses: softprops/action-gh-release@v0.1.5
env:
GITHUB_TOKEN: ${{ github.token }}
with:
files: |
hio-raspbian-bullseye-desktop-grafana-influxdb-${{env.VERSION}}.zip
hio-raspbian-bullseye-desktop-${{env.VERSION}}.zip
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

39 changes: 19 additions & 20 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ set -eu

. ./utils.sh



if [[ ! -v URL ]]; then
URL="http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2020-02-14/2020-02-13-raspbian-buster-lite.zip"
SHA256="12ae6e17bf95b6ba83beca61e7394e7411b45eba7e6a520f434b0748ea7370e8"
NAME="hio-raspbian-buster-lite"
URL="https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2022-09-26/2022-09-22-raspios-bullseye-armhf-lite.img.xz"
SHA256="9bf5234efbadd2d39769486e0a20923d8526a45eba57f74cda45ef78e2b628da"
NAME="hio-raspbian-bullseye-lite"
fi

IMAGE=${URL##*/}
IMAGE="$(pwd)/${IMAGE%.*}.img"
IMAGE="$(pwd)/${IMAGE%.*}"

check_is_run_as_root

Expand All @@ -31,18 +33,15 @@ if [ ! -f /usr/bin/qemu-arm-static ]; then
die "Missing /usr/bin/qemu-arm-static"
fi

IMAGE_ZIP="${IMAGE}.zip"
IMAGE_XZ="${IMAGE}.xz"

step "Download"
echo "$URL as $IMAGE_ZIP"
wget -q "$URL" -O "$IMAGE_ZIP"
check_sha256_sum "$IMAGE_ZIP" $SHA256

echo "$URL as $IMAGE_XZ"
wget -q "$URL" -O "$IMAGE_XZ"
check_sha256_sum "$IMAGE_XZ" $SHA256

step "Uzip"
unzip -o "$IMAGE_ZIP"
rm "$IMAGE_ZIP"

unxz "$IMAGE_XZ"

step "Resize image"
img_resize "$IMAGE" 512
Expand All @@ -66,7 +65,7 @@ install -m 755 -o 0 -g 0 files/update-motd.d/* "$ROOT_DIR/etc/update-motd.d/"
cp -r files/node-red "$ROOT_DIR/home/pi/.node-red"
chown 1000:1000 -R "$ROOT_DIR/home/pi/.node-red"
install -m 666 files/wpa_supplicant.example.conf "$ROOT_DIR/boot/wpa_supplicant.example.conf"
echo "${TRAVIS_TAG:-vdev}" > "$ROOT_DIR/usr/lib/hub-version"
echo "${VERSION:-vdev}" > "$ROOT_DIR/usr/lib/hub-version"


step "Chroot enable"
Expand Down Expand Up @@ -96,15 +95,15 @@ step "Shrink img"
img_shrink "$IMAGE"


step "Zip $NAME-${TRAVIS_TAG:-vdev}"
mv "$IMAGE" "$NAME-${TRAVIS_TAG:-vdev}.img"
zip "$NAME-${TRAVIS_TAG:-vdev}.zip" "$NAME-${TRAVIS_TAG:-vdev}.img"
step "Zip $NAME-${VERSION:-vdev}"
mv "$IMAGE" "$NAME-${VERSION:-vdev}.img"
zip "$NAME-${VERSION:-vdev}.zip" "$NAME-${VERSION:-vdev}.img"


einfo "--- Grafana, InfluxDB, mqtt2influxdb ---"

step "Rename img"
mv "$NAME-${TRAVIS_TAG:-vdev}.img" "$IMAGE"
mv "$NAME-${VERSION:-vdev}.img" "$IMAGE"


step "Resize image"
Expand Down Expand Up @@ -142,6 +141,6 @@ step "Shrink img"
img_shrink "$IMAGE"


step "Zip $NAME-grafana-influxdb-${TRAVIS_TAG:-vdev}"
mv $IMAGE "$NAME-grafana-influxdb-${TRAVIS_TAG:-vdev}.img"
zip "$NAME-grafana-influxdb-${TRAVIS_TAG:-vdev}.zip" "$NAME-grafana-influxdb-${TRAVIS_TAG:-vdev}.img"
step "Zip $NAME-grafana-influxdb-${VERSION:-vdev}"
mv $IMAGE "$NAME-grafana-influxdb-${VERSION:-vdev}.img"
zip "$NAME-grafana-influxdb-${VERSION:-vdev}.zip" "$NAME-grafana-influxdb-${VERSION:-vdev}.img"
File renamed without changes.
2 changes: 1 addition & 1 deletion install-grafana-influxdb-mqtt2influxdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ sudo -H pip3 install -U --no-cache-dir mqtt2influxdb

step 'Download default config for HARDWARIO Kit'
sudo mkdir -p /etc/hardwario
sudo wget "https://raw.githubusercontent.com/bigclownlabs/bch-mqtt2influxdb/master/config-bigclown.yml" -O "/etc/hardwario/mqtt2influxdb.yml"
sudo wget "https://raw.githubusercontent.com/hardwario/bch-mqtt2influxdb/master/config-bigclown.yml" -O "/etc/hardwario/mqtt2influxdb.yml"

step 'Configuration file test'
mqtt2influxdb -c /etc/hardwario/mqtt2influxdb.yml --test
Expand Down
9 changes: 5 additions & 4 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ img_umount() {
umount -l "${ROOT_DIR}/boot"
umount -l "${ROOT_DIR}"

sleep 1
sleep 5m

kpartx -d -v "${IMAGE}"

sleep 5m

rmdir "${ROOT_DIR}"
}

Expand All @@ -118,7 +120,6 @@ chroot_enable() {
echo "Disable IPv6 in APT"
echo 'Acquire::ForceIPv4 "true";' >> "$ROOT_DIR/etc/apt/apt.conf.d/99force-ipv4"
echo "Modify source.list"
sed -r -i'' "s/raspbian.raspberrypi.org\/raspbian/reflection.oss.ou.edu\/raspbian\/raspbian/g" "$ROOT_DIR/etc/apt/sources.list"
}

chroot_disable() {
Expand All @@ -144,7 +145,7 @@ chroot_disable() {
chroot_bash() {
# HOME=/home/pi LC_ALL='C.UTF-8' chroot --userspec=1000:1000 ${ROOT_DIR} /bin/bash
# HOME=/home/pi LC_ALL='C.UTF-8' setarch linux32 chroot --userspec=1000:1000 ${ROOT_DIR} /bin/bash
systemd-nspawn -D "${ROOT_DIR}" -E HOME=/home/pi -E LC_ALL='C.UTF-8' -u 1000 bin/bash
systemd-nspawn -D "${ROOT_DIR}" -E HOME=/home/pi -E LC_ALL='C.UTF-8' --pipe -u 1000 bin/bash
}

chroot_cmd() {
Expand Down Expand Up @@ -188,7 +189,7 @@ img_shrink() {
fi

losetup -d "$loopback"
sleep 1
sleep 5m

#Shrink partition
partnewsize=$(($minsize * $blocksize))
Expand Down

0 comments on commit 25c942d

Please sign in to comment.