From 48990e67e11c75e8d6e6d40440726d1e50a10261 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 7 Oct 2019 19:26:40 +0200 Subject: [PATCH] Add mods for nymea --- .gitignore | 3 - config | 5 ++ nymea-kiosk/00-sys-tweaks/00-run-chroot.sh | 11 ++++ nymea-kiosk/01-packages/05-packages | 2 + nymea-kiosk/EXPORT_IMAGE | 4 ++ nymea-kiosk/prerun.sh | 5 ++ nymea/00-sys-tweaks/00-run-chroot.sh | 66 ++++++++++++++++++++++ nymea/01-packages/05-packages | 4 ++ nymea/EXPORT_IMAGE | 4 ++ nymea/prerun.sh | 5 ++ stage2/SKIP_IMAGES | 0 stage3/SKIP | 0 stage3/SKIP_IMAGES | 0 stage4/SKIP | 0 stage4/SKIP_IMAGES | 0 stage5/SKIP | 0 stage5/SKIP_IMAGES | 0 17 files changed, 106 insertions(+), 3 deletions(-) create mode 100644 config create mode 100755 nymea-kiosk/00-sys-tweaks/00-run-chroot.sh create mode 100644 nymea-kiosk/01-packages/05-packages create mode 100644 nymea-kiosk/EXPORT_IMAGE create mode 100755 nymea-kiosk/prerun.sh create mode 100755 nymea/00-sys-tweaks/00-run-chroot.sh create mode 100644 nymea/01-packages/05-packages create mode 100644 nymea/EXPORT_IMAGE create mode 100755 nymea/prerun.sh create mode 100644 stage2/SKIP_IMAGES create mode 100644 stage3/SKIP create mode 100644 stage3/SKIP_IMAGES create mode 100644 stage4/SKIP create mode 100644 stage4/SKIP_IMAGES create mode 100644 stage5/SKIP create mode 100644 stage5/SKIP_IMAGES diff --git a/.gitignore b/.gitignore index a6883c2049..96a23b6acf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,6 @@ deploy/* work/* -config postrun.sh -SKIP -SKIP_IMAGES .pc *-pc apt-cacher-ng/ diff --git a/config b/config new file mode 100644 index 0000000000..1b0430c57b --- /dev/null +++ b/config @@ -0,0 +1,5 @@ +IMG_NAME=nymea-bullseye +FIRST_USER_NAME="nymea" +FIRST_USER_PASS="nymea" +ENABLE_SSH=1 +STAGE_LIST="stage0 stage1 stage2 nymea nymea-kiosk" diff --git a/nymea-kiosk/00-sys-tweaks/00-run-chroot.sh b/nymea-kiosk/00-sys-tweaks/00-run-chroot.sh new file mode 100755 index 0000000000..490bb84baa --- /dev/null +++ b/nymea-kiosk/00-sys-tweaks/00-run-chroot.sh @@ -0,0 +1,11 @@ +# Rotate internal display by default +echo lcd_rotate=2 >> /boot/config.txt + +# Enable fake KMS driver, the real kms causes issues +sed -i 's/vc4-kms-v3d/vc4-fkms-v3d/' /boot/config.txt + +# Get away with the low voltage warning +echo avoid_warnings=1 >> /boot/config.txt + +# Hide console log messages and blinking cursor and activate the splash +sed -i "s/console=tty1/console=tty3 quiet vt.global_cursor_default=0 splash/" "/boot/cmdline.txt" diff --git a/nymea-kiosk/01-packages/05-packages b/nymea-kiosk/01-packages/05-packages new file mode 100644 index 0000000000..069072ccb7 --- /dev/null +++ b/nymea-kiosk/01-packages/05-packages @@ -0,0 +1,2 @@ +nymea-app-kiosk-wayland +nymea-splashscreen diff --git a/nymea-kiosk/EXPORT_IMAGE b/nymea-kiosk/EXPORT_IMAGE new file mode 100644 index 0000000000..0e5cb739ad --- /dev/null +++ b/nymea-kiosk/EXPORT_IMAGE @@ -0,0 +1,4 @@ +IMG_SUFFIX="-kiosk" +if [ "${USE_QEMU}" = "1" ]; then + export IMG_SUFFIX="${IMG_SUFFIX}-qemu" +fi diff --git a/nymea-kiosk/prerun.sh b/nymea-kiosk/prerun.sh new file mode 100755 index 0000000000..9acd13cbd3 --- /dev/null +++ b/nymea-kiosk/prerun.sh @@ -0,0 +1,5 @@ +#!/bin/bash -e + +if [ ! -d "${ROOTFS_DIR}" ]; then + copy_previous +fi diff --git a/nymea/00-sys-tweaks/00-run-chroot.sh b/nymea/00-sys-tweaks/00-run-chroot.sh new file mode 100755 index 0000000000..e316256905 --- /dev/null +++ b/nymea/00-sys-tweaks/00-run-chroot.sh @@ -0,0 +1,66 @@ +# Add nymea repository +echo -e "\n## nymea repo\ndeb http://repository.nymea.io bullseye rpi\n#deb-src http://repository.nymea.io bullseye rpi" | tee /etc/apt/sources.list.d/nymea.list +wget -qO - http://repository.nymea.io/repository-pubkey.gpg | apt-key add - + +# Set repository priority (prefer packages from raspbian section) +cat </etc/apt/preferences.d/nymea +Package: * +Pin: release c=raspios +Pin-Priority: 700 + +Package: * +Pin: origin repository.nymea.io c=main +Pin-Priority: 500 +EOM + +apt-get update + +cat < /etc/motd + + . + ++, + |\`--\`+-. + \`\`--\`-++. .;;+. + \\\`\`--*++++;;;/@\\ _ __ _ _ _ __ ___ ___ __ _ + \\\`*#;.++++\\;+|/ | '_ \| | | | '_ \` _ \\ / _ \\/ _\` | + \`-###+++++;\` | | | | |_| | | | | | | __/ (_| | + /###+++ |_| |_|\__, |_| |_| |_|\___|\__,_| + |+++#\` __/ | + \`###+. |___/ + \`###+ + \`#+ + \` + +EOM + + +cat < /etc/machine-info +PRETTY_HOSTNAME=nymea +EOM + +cat < /etc/issue.net +nymea - nymea.io | Debian GNU/Linux 11 +EOM + +cat < /etc/issue +nymea - nymea.io | Debian GNU/Linux 11 \n \l +EOM + +# Change hostname to nymea +echo nymea > /etc/hostname +sed -i 's/localhost/localhost nymea/' /etc/hosts + +# Enable i2c +echo dtparam=i2c_arm=on >> /boot/config.txt +echo i2c-dev >> /etc/modules + +# Drop packages conflicting with network-manager +apt-get purge --yes openresolv dhcpcd5 + +# Disable BlueZ plugins QtBluetooth can't deal with +mkdir /etc/systemd/system/bluetooth.service.d +cat < /etc/systemd/system/bluetooth.service.d/01-disable-battery-plugin.conf +[Service] +ExecStart= +ExecStart=/usr/libexec/bluetooth/bluetoothd --noplugin=battery,sap +EOM diff --git a/nymea/01-packages/05-packages b/nymea/01-packages/05-packages new file mode 100644 index 0000000000..e2d6aaf2e7 --- /dev/null +++ b/nymea/01-packages/05-packages @@ -0,0 +1,4 @@ +nymea +nymea-plugins +nymea-plugins-zigbee +nymea-networkmanager diff --git a/nymea/EXPORT_IMAGE b/nymea/EXPORT_IMAGE new file mode 100644 index 0000000000..33379117ac --- /dev/null +++ b/nymea/EXPORT_IMAGE @@ -0,0 +1,4 @@ +IMG_SUFFIX="-core" +if [ "${USE_QEMU}" = "1" ]; then + export IMG_SUFFIX="${IMG_SUFFIX}-qemu" +fi diff --git a/nymea/prerun.sh b/nymea/prerun.sh new file mode 100755 index 0000000000..9acd13cbd3 --- /dev/null +++ b/nymea/prerun.sh @@ -0,0 +1,5 @@ +#!/bin/bash -e + +if [ ! -d "${ROOTFS_DIR}" ]; then + copy_previous +fi diff --git a/stage2/SKIP_IMAGES b/stage2/SKIP_IMAGES new file mode 100644 index 0000000000..e69de29bb2 diff --git a/stage3/SKIP b/stage3/SKIP new file mode 100644 index 0000000000..e69de29bb2 diff --git a/stage3/SKIP_IMAGES b/stage3/SKIP_IMAGES new file mode 100644 index 0000000000..e69de29bb2 diff --git a/stage4/SKIP b/stage4/SKIP new file mode 100644 index 0000000000..e69de29bb2 diff --git a/stage4/SKIP_IMAGES b/stage4/SKIP_IMAGES new file mode 100644 index 0000000000..e69de29bb2 diff --git a/stage5/SKIP b/stage5/SKIP new file mode 100644 index 0000000000..e69de29bb2 diff --git a/stage5/SKIP_IMAGES b/stage5/SKIP_IMAGES new file mode 100644 index 0000000000..e69de29bb2