diff --git a/Documentation/boards/ova.md b/Documentation/boards/ova.md new file mode 100644 index 000000000..0a625dde7 --- /dev/null +++ b/Documentation/boards/ova.md @@ -0,0 +1,16 @@ +# OVA + +The OVA stay for open virtual appliance. Currently we had remove the ova files and publish a vmdk virtual disk, +until we have better OVF template to generate our OVA. This vmdk work with (maybe you need convert the disk): +- HyperV +- VirtualBox +- VMware + +## Virtual Machine + +You can use this vmdk in a virtual machine with follow requirements: +- OS: Linux 64bit +- UEFI boot +- min. 1GB RAM +- 2x vcpu +- 1x Network diff --git a/Documentation/configuration.md b/Documentation/configuration.md index 7af004b42..2fe7b2816 100644 --- a/Documentation/configuration.md +++ b/Documentation/configuration.md @@ -2,18 +2,23 @@ ## Automatic -You can format a USB stick with FAT32 and name it with `hassos-config`. The layout could be look like: +You can use a USB drive with HassOS to configure network options, ssh access to the host, and to install updates. +Format a USB stick with FAT32/EXT4/NTFS and name it `CONFIG`. Use the following directory structure within the USB drive: + ``` network/ modules/ -known_hosts +authorized_keys hassos-xy.raucb ``` -- On `network` folder can hold any kind of NetworkManager connections files. -- The folder `modules` is for modules-load configuration files. -- `known_hosts` file activate debug SSH access of port `22222`. -- For firmware updates you can but the `hassos-*.raucb` OTA update they should be install. +- The `network` folder can contain any kind of NetworkManager connection files. For more information see [Network][network.md]. +- The `modules` folder is for modules-load configuration files. +- The `authorized_keys` file activates debug SSH access on port `22222`. See [Debugging Hassio][debug-hassio]. +- The `hassos-*.raucb` file is a firmware OTA update which will be installed. These can be found on on the [release][hassos-release] page. + +You can put this USB stick into the device and it will be read on startup. You can also trigger this process later over the +API/UI or by calling `systemctl restart hassos-config` on the host. ## Local @@ -25,5 +30,11 @@ You can edit or create a `cmdline.txt` into your boot partition. That will be re The kernel module folder `/etc/modules-load.d` is persistent and you can add your config files there. See [Systemd modules load][systemd-modules]. +### Network + +You can manual add, edit or remove connections configs from `/etc/NetworkManager/system-connections`. [systemd-modules]: https://www.freedesktop.org/software/systemd/man/modules-load.d.html +[network.md]: network.md +[hassos-release]: https://github.com/home-assistant/hassos/releases/ +[debug-hassio]: https://developers.home-assistant.io/docs/en/hassio_debugging.html diff --git a/Documentation/network.md b/Documentation/network.md new file mode 100644 index 000000000..67e9a9b08 --- /dev/null +++ b/Documentation/network.md @@ -0,0 +1,98 @@ +# Network + +HassOS uses NetworkManager to control the host network. In future releases, you can set up the configuration using the API/UI. +Currently only manual configuration using NetworkManager connection files is supported. Without a configuration file, the device will use DHCP by default. These network connection files can be placed on a USB drive as described in [Configuration][configuration-usb]. + +## Configuration Examples + +You can look also into [Official Manual][keyfile] or there are a lot of examples accross internet. The system is read only, if you not want change the IP address every boot, you should set the uuid property with a generic [UUID4][uuid]. + +### Default + +We have a preinstalled connection profile: +``` +[connection] +id=HassOS default +uuid=f62bf7c2-e565-49ff-bbfc-a4cf791e6add +type=802-3-ethernet + +[ipv4] +method=auto + +[ipv6] +addr-gen-mode=stable-privacy +method=auto +``` + +### LAN +```ini +[connection] +id=hassos-network +uuid=d55162b4-6152-4310-9312-8f4c54d86afa +type=802-3-ethernet + +[ipv4] +method=auto + +[ipv6] +addr-gen-mode=stable-privacy +method=auto +``` + +### Wireless WPA/PSK +```ini +[connection] +id=hassos-network +uuid=72111c67-4a5d-4d5c-925e-f8ee26efb3c3 +type=802-11-wireless + +[wifi] +mode=infrastructure +ssid=MY_SSID + +[wifi-security] +auth-alg=open +key-mgmt=wpa-psk +psk=MY_WLAN_SECRED_KEY + +[ipv4] +method=auto + +[ipv6] +addr-gen-mode=stable-privacy +method=auto +``` + +### Static IP + +Replace follow configs: +```ini +[ipv4] +method=manual +address1=192.168.1.111/24,192.168.1.1 +dns=8.8.8.8;8.8.4.4; +``` + +## Tips + +### Reset network + +If you want reset the network configuration to default, use follow commands on host: +```bash +$ rm /etc/NetworkManager/system-connections/* +$ cp /usr/share/system-connections/* /etc/NetworkManager/system-connections/ +$ nmcli con reload +``` + +### Powersave + +If you have trouble with powersave you can do following: +```ini +[wifi] +# Values are 0 (use default), 1 (ignore/don't touch), 2 (disable) or 3 (enable). +powersave=0 +``` + +[keyfile]: https://developer.gnome.org/NetworkManager/stable/nm-settings.html +[configuration-usb]: configuration.md +[uuid]: https://www.uuidgenerator.net/ diff --git a/buildroot-external/board/raspberrypi/post-image.sh b/buildroot-external/board/raspberrypi/post-image.sh index 7f1e1ef78..9a056687a 100755 --- a/buildroot-external/board/raspberrypi/post-image.sh +++ b/buildroot-external/board/raspberrypi/post-image.sh @@ -7,6 +7,7 @@ BOOT_DATA=${BINARIES_DIR}/boot . ${SCRIPT_DIR}/hdd-image.sh . ${SCRIPT_DIR}/name.sh +. ${SCRIPT_DIR}/ota.sh . ${BR2_EXTERNAL_HASSOS_PATH}/info . ${BOARD_DIR}/info diff --git a/buildroot-external/board/raspberrypi/rpi3-64/uboot-boot.sh b/buildroot-external/board/raspberrypi/rpi3-64/uboot-boot.sh index 02843f58e..6b04956e3 100644 --- a/buildroot-external/board/raspberrypi/rpi3-64/uboot-boot.sh +++ b/buildroot-external/board/raspberrypi/rpi3-64/uboot-boot.sh @@ -3,7 +3,7 @@ test -n "${BOOT_A_LEFT}" || setenv BOOT_A_LEFT 3 test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3 # HassOS bootargs -setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 apparmor=1 security=apparmor rootwait" +setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 apparmor=1 security=apparmor rootwait cgroup_enable=memory" # HassOS system A/B setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd rootfstype=squashfs ro" @@ -49,3 +49,6 @@ echo "Loading kernel" run load_kernel echo " Starting kernel" booti ${kernel_addr_r} - ${fdt_addr} + +echo "Fails on boot" +reset diff --git a/buildroot-external/board/raspberrypi/uboot-boot.sh b/buildroot-external/board/raspberrypi/uboot-boot.sh index 6a3ed9f81..d4f4e8fa9 100644 --- a/buildroot-external/board/raspberrypi/uboot-boot.sh +++ b/buildroot-external/board/raspberrypi/uboot-boot.sh @@ -3,7 +3,7 @@ test -n "${BOOT_A_LEFT}" || setenv BOOT_A_LEFT 3 test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3 # HassOS bootargs -setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 apparmor=1 security=apparmor rootwait" +setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 apparmor=1 security=apparmor rootwait cgroup_enable=memory" # HassOS system A/B setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd rootfstype=squashfs ro" @@ -49,3 +49,6 @@ echo "Loading kernel" run load_kernel echo " Starting kernel" bootz ${kernel_addr_r} - ${fdt_addr} + +echo "Fails on boot" +reset diff --git a/buildroot-external/configs/ova_defconfig b/buildroot-external/configs/ova_defconfig index 89696c18a..bccbe9e18 100644 --- a/buildroot-external/configs/ova_defconfig +++ b/buildroot-external/configs/ova_defconfig @@ -40,6 +40,8 @@ BR2_PACKAGE_AVAHI=y # BR2_PACKAGE_AVAHI_AUTOIPD is not set BR2_PACKAGE_AVAHI_DAEMON=y BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y +BR2_PACKAGE_DHCP=y +BR2_PACKAGE_DHCP_CLIENT=y BR2_PACKAGE_DROPBEAR=y # BR2_PACKAGE_DROPBEAR_CLIENT is not set # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set @@ -73,12 +75,12 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/amd64-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="109" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="115" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/qemux86-64-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/amd64-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="5" +BR2_PACKAGE_HASSOS_CLI_VERSION="6" BR2_PACKAGE_HASSOS_CLI_ARGS="--network=hassio --add-host hassio:172.30.32.2" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" diff --git a/buildroot-external/configs/rpi0_w_defconfig b/buildroot-external/configs/rpi0_w_defconfig index af10220b3..e758e6e09 100644 --- a/buildroot-external/configs/rpi0_w_defconfig +++ b/buildroot-external/configs/rpi0_w_defconfig @@ -48,6 +48,8 @@ BR2_PACKAGE_AVAHI=y # BR2_PACKAGE_AVAHI_AUTOIPD is not set BR2_PACKAGE_AVAHI_DAEMON=y BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y +BR2_PACKAGE_DHCP=y +BR2_PACKAGE_DHCP_CLIENT=y BR2_PACKAGE_DROPBEAR=y # BR2_PACKAGE_DROPBEAR_CLIENT is not set # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set @@ -82,12 +84,12 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="109" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="115" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="5" +BR2_PACKAGE_HASSOS_CLI_VERSION="6" BR2_PACKAGE_HASSOS_CLI_ARGS="--network=hassio --add-host hassio:172.30.32.2" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" diff --git a/buildroot-external/configs/rpi2_defconfig b/buildroot-external/configs/rpi2_defconfig index 5cad57467..e2dae9c45 100644 --- a/buildroot-external/configs/rpi2_defconfig +++ b/buildroot-external/configs/rpi2_defconfig @@ -47,6 +47,8 @@ BR2_PACKAGE_AVAHI=y # BR2_PACKAGE_AVAHI_AUTOIPD is not set BR2_PACKAGE_AVAHI_DAEMON=y BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y +BR2_PACKAGE_DHCP=y +BR2_PACKAGE_DHCP_CLIENT=y BR2_PACKAGE_DROPBEAR=y # BR2_PACKAGE_DROPBEAR_CLIENT is not set # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set @@ -81,12 +83,12 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="109" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="115" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi2-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="5" +BR2_PACKAGE_HASSOS_CLI_VERSION="6" BR2_PACKAGE_HASSOS_CLI_ARGS="--network=hassio --add-host hassio:172.30.32.2" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" diff --git a/buildroot-external/configs/rpi3_64_defconfig b/buildroot-external/configs/rpi3_64_defconfig index 3cc5f2e69..b82e30ad0 100644 --- a/buildroot-external/configs/rpi3_64_defconfig +++ b/buildroot-external/configs/rpi3_64_defconfig @@ -48,6 +48,8 @@ BR2_PACKAGE_AVAHI=y # BR2_PACKAGE_AVAHI_AUTOIPD is not set BR2_PACKAGE_AVAHI_DAEMON=y BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y +BR2_PACKAGE_DHCP=y +BR2_PACKAGE_DHCP_CLIENT=y BR2_PACKAGE_DROPBEAR=y # BR2_PACKAGE_DROPBEAR_CLIENT is not set # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set @@ -82,12 +84,12 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/aarch64-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="109" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="115" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi3-64-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/aarch64-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="5" +BR2_PACKAGE_HASSOS_CLI_VERSION="6" BR2_PACKAGE_HASSOS_CLI_ARGS="--network=hassio --add-host hassio:172.30.32.2" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" diff --git a/buildroot-external/configs/rpi3_defconfig b/buildroot-external/configs/rpi3_defconfig index b4de4194a..64cccbc6a 100644 --- a/buildroot-external/configs/rpi3_defconfig +++ b/buildroot-external/configs/rpi3_defconfig @@ -48,6 +48,8 @@ BR2_PACKAGE_AVAHI=y # BR2_PACKAGE_AVAHI_AUTOIPD is not set BR2_PACKAGE_AVAHI_DAEMON=y BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y +BR2_PACKAGE_DHCP=y +BR2_PACKAGE_DHCP_CLIENT=y BR2_PACKAGE_DROPBEAR=y # BR2_PACKAGE_DROPBEAR_CLIENT is not set # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set @@ -82,12 +84,12 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="109" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="115" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi3-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="5" +BR2_PACKAGE_HASSOS_CLI_VERSION="6" BR2_PACKAGE_HASSOS_CLI_ARGS="--network=hassio --add-host hassio:172.30.32.2" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" diff --git a/buildroot-external/configs/rpi_defconfig b/buildroot-external/configs/rpi_defconfig index bab699e35..6d7747271 100644 --- a/buildroot-external/configs/rpi_defconfig +++ b/buildroot-external/configs/rpi_defconfig @@ -47,6 +47,8 @@ BR2_PACKAGE_AVAHI=y # BR2_PACKAGE_AVAHI_AUTOIPD is not set BR2_PACKAGE_AVAHI_DAEMON=y BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY=y +BR2_PACKAGE_DHCP=y +BR2_PACKAGE_DHCP_CLIENT=y BR2_PACKAGE_DROPBEAR=y # BR2_PACKAGE_DROPBEAR_CLIENT is not set # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set @@ -81,12 +83,12 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_RAUC=y BR2_PACKAGE_HASSOS=y BR2_PACKAGE_HASSOS_SUPERVISOR="homeassistant/armhf-hassio-supervisor" -BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="109" +BR2_PACKAGE_HASSOS_SUPERVISOR_VERSION="115" BR2_PACKAGE_HASSOS_SUPERVISOR_ARGS="-e HOMEASSISTANT_REPOSITORY=homeassistant/raspberrypi-homeassistant" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE="hassio-supervisor" BR2_PACKAGE_HASSOS_SUPERVISOR_PROFILE_URL="http://s3.amazonaws.com/hassio-version/apparmor.txt" BR2_PACKAGE_HASSOS_CLI="homeassistant/armhf-hassio-cli" -BR2_PACKAGE_HASSOS_CLI_VERSION="5" +BR2_PACKAGE_HASSOS_CLI_VERSION="6" BR2_PACKAGE_HASSOS_CLI_ARGS="--network=hassio --add-host hassio:172.30.32.2" BR2_PACKAGE_HASSOS_CLI_PROFILE="docker-default" BR2_PACKAGE_HASSOS_APPARMOR_DIR="supervisor/apparmor" diff --git a/buildroot-external/info b/buildroot-external/info index 445b1d82e..2944e92da 100644 --- a/buildroot-external/info +++ b/buildroot-external/info @@ -1,5 +1,5 @@ -VERSION_MAJOR=0 -VERSION_BUILD=7 +VERSION_MAJOR=2 +VERSION_BUILD=0 HASSOS_NAME="HassOS" HASSOS_ID="hassos" diff --git a/buildroot-external/rootfs-overlay/etc/NetworkManager/NetworkManager.conf b/buildroot-external/rootfs-overlay/etc/NetworkManager/NetworkManager.conf index 7d62bd22d..3510d5475 100644 --- a/buildroot-external/rootfs-overlay/etc/NetworkManager/NetworkManager.conf +++ b/buildroot-external/rootfs-overlay/etc/NetworkManager/NetworkManager.conf @@ -6,3 +6,6 @@ rc-manager=file [keyfile] unmanaged-devices=type:bridge;type:tun;type:veth + +[logging] +backend=journal diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/NetworkManager.service.d/hassos.conf b/buildroot-external/rootfs-overlay/etc/systemd/system/NetworkManager.service.d/hassos.conf new file mode 100644 index 000000000..09dd23d8b --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/NetworkManager.service.d/hassos.conf @@ -0,0 +1,2 @@ +[Unit] +RequiresMountsFor=/etc/hostname /etc/hosts /etc/NetworkManager/system-connections diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/avahi-daemon.service.d/hassos.conf b/buildroot-external/rootfs-overlay/etc/systemd/system/avahi-daemon.service.d/hassos.conf new file mode 100644 index 000000000..7a243b5b1 --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/avahi-daemon.service.d/hassos.conf @@ -0,0 +1,2 @@ +[Unit] +RequiresMountsFor=/etc/hostname diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/avahi-daemon.service.d/nm.conf b/buildroot-external/rootfs-overlay/etc/systemd/system/avahi-daemon.service.d/nm.conf new file mode 100644 index 000000000..0a38143e9 --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/avahi-daemon.service.d/nm.conf @@ -0,0 +1,3 @@ +[Unit] +Wants=network-online.target +After=network-online.target diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/dropbear.service.d/hassos.conf b/buildroot-external/rootfs-overlay/etc/systemd/system/dropbear.service.d/hassos.conf index 4967b8871..5da76e50a 100644 --- a/buildroot-external/rootfs-overlay/etc/systemd/system/dropbear.service.d/hassos.conf +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/dropbear.service.d/hassos.conf @@ -1,6 +1,6 @@ [Unit] RequiresMountsFor=/etc/dropbear -ConditionFileNotEmpty=/root/.ssh/known_hosts +ConditionFileNotEmpty=/root/.ssh/authorized_keys [Service] ExecStartPre= diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/getty@.service.d/hassos.conf b/buildroot-external/rootfs-overlay/etc/systemd/system/getty@.service.d/hassos.conf new file mode 100644 index 000000000..2217bfed9 --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/getty@.service.d/hassos.conf @@ -0,0 +1,3 @@ +[Unit] +Wants=hassos-supervisor.service +After=hassos-supervisor.service diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/hassos-bind.target.wants/root-.ssh.mount b/buildroot-external/rootfs-overlay/etc/systemd/system/hassos-bind.target.wants/root-.ssh.mount new file mode 120000 index 000000000..84b3685f2 --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/hassos-bind.target.wants/root-.ssh.mount @@ -0,0 +1 @@ +/usr/lib/systemd/system/root-.ssh.mount \ No newline at end of file diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/hassos-bind.target.wants/var-lib-NetworkManager.mount b/buildroot-external/rootfs-overlay/etc/systemd/system/hassos-bind.target.wants/var-lib-NetworkManager.mount new file mode 120000 index 000000000..eea387e8c --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/hassos-bind.target.wants/var-lib-NetworkManager.mount @@ -0,0 +1 @@ +/usr/lib/systemd/system/var-lib-NetworkManager.mount \ No newline at end of file diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-apparmor.service b/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-apparmor.service index 5c3399155..3caec078f 120000 --- a/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-apparmor.service +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-apparmor.service @@ -1 +1 @@ -/usr/lib/systemd/system/hassos-apparmor.service +/usr/lib/systemd/system/hassos-apparmor.service \ No newline at end of file diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-bind.target b/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-bind.target index 60e9c455b..afb44860c 120000 --- a/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-bind.target +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-bind.target @@ -1 +1 @@ -/usr/lib/systemd/system/hassos-bind.target +/usr/lib/systemd/system/hassos-bind.target \ No newline at end of file diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-config.service b/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-config.service index bbd767dd6..24c0f09e3 120000 --- a/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-config.service +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-config.service @@ -1 +1 @@ -/usr/lib/systemd/system/hassos-config.service +/usr/lib/systemd/system/hassos-config.service \ No newline at end of file diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-persists-journald.service b/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-persists-journald.service new file mode 120000 index 000000000..fdc4db7b8 --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-persists-journald.service @@ -0,0 +1 @@ +/usr/lib/systemd/system/hassos-persists-journald.service \ No newline at end of file diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-supervisor.service b/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-supervisor.service index b8b6bdf79..17b423d69 120000 --- a/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-supervisor.service +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-supervisor.service @@ -1 +1 @@ -/usr/lib/systemd/system/hassos-supervisor.service +/usr/lib/systemd/system/hassos-supervisor.service \ No newline at end of file diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-zram.target b/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-zram.target index d554b3c69..decfca7a2 120000 --- a/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-zram.target +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/multi-user.target.wants/hassos-zram.target @@ -1 +1 @@ -/usr/lib/systemd/system/hassos-zram.target +/usr/lib/systemd/system/hassos-zram.target \ No newline at end of file diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/serial-getty@.service.d/docker.conf b/buildroot-external/rootfs-overlay/etc/systemd/system/serial-getty@.service.d/docker.conf new file mode 100644 index 000000000..53a8d88b0 --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/serial-getty@.service.d/docker.conf @@ -0,0 +1,3 @@ +[Unit] +Requires=docker.service +After=docker.service diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/serial-getty@.service.d/hassos.conf b/buildroot-external/rootfs-overlay/etc/systemd/system/serial-getty@.service.d/hassos.conf index 53a8d88b0..2217bfed9 100644 --- a/buildroot-external/rootfs-overlay/etc/systemd/system/serial-getty@.service.d/hassos.conf +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/serial-getty@.service.d/hassos.conf @@ -1,3 +1,3 @@ [Unit] -Requires=docker.service -After=docker.service +Wants=hassos-supervisor.service +After=hassos-supervisor.service diff --git a/buildroot-external/rootfs-overlay/etc/tmpfiles.d/nm.conf b/buildroot-external/rootfs-overlay/etc/tmpfiles.d/nm.conf new file mode 100644 index 000000000..5089e77ff --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/tmpfiles.d/nm.conf @@ -0,0 +1,3 @@ +# Cleanup lease files +e /var/lib/NetworkManager/*.lease - - - 14d +C /mnt/overlay/etc/NetworkManager/system-connections - - - - /usr/share/system-connections diff --git a/buildroot-external/rootfs-overlay/usr/lib/rauc/post-install b/buildroot-external/rootfs-overlay/usr/lib/rauc/post-install index f07bc2638..b552daafc 100755 --- a/buildroot-external/rootfs-overlay/usr/lib/rauc/post-install +++ b/buildroot-external/rootfs-overlay/usr/lib/rauc/post-install @@ -1,4 +1,3 @@ #!/bin/sh systemctl start mnt-boot.mount -systemctl reboot diff --git "a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-NetworkManager-system\\x2dconnections.mount" "b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-NetworkManager-system\\x2dconnections.mount" index c312ebbb9..ea15e6132 100644 --- "a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-NetworkManager-system\\x2dconnections.mount" +++ "b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-NetworkManager-system\\x2dconnections.mount" @@ -1,7 +1,7 @@ [Unit] Description=NetworkManager persistent system connections Requires=mnt-overlay.mount -After=mnt-overlay.mount +After=mnt-overlay.mount systemd-tmpfiles-setup.service Before=NetworkManager.service hassos-config.service [Mount] diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/hassos-persists-journald.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/hassos-persists-journald.service new file mode 100644 index 000000000..0f98b1fae --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/hassos-persists-journald.service @@ -0,0 +1,14 @@ +[Unit] +Description=HassOS persists journald +Requires=var-log-journal.mount +After=sysinit.target systemd-journald.service +RefuseManualStart=true +RefuseManualStop=true + +[Service] +Type=oneshot +ExecStart=/usr/sbin/hassos-persists-journald +RemainAfterExit=true + +[Install] +WantedBy=multi-user.target diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/hassos-supervisor.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/hassos-supervisor.service index 66bde2b66..d21ac9897 100644 --- a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/hassos-supervisor.service +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/hassos-supervisor.service @@ -1,7 +1,8 @@ [Unit] Description=HassOS supervisor Requires=docker.service -After=docker.service dbus.socket +Wants=network-online.target +After=docker.service rauc.service dbus.socket network-online.target RequiresMountsFor=/mnt/data StartLimitIntervalSec=60 StartLimitBurst=5 diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/mnt-config.mount b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/mnt-config.mount index fd886e1b7..116ee32ae 100644 --- a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/mnt-config.mount +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/mnt-config.mount @@ -2,7 +2,7 @@ Description=HassOS config partition [Mount] -What=LABEL=hassos-config +What=LABEL=CONFIG Where=/mnt/config Type=auto Options=ro diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/var-lib-NetworkManager.mount b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/var-lib-NetworkManager.mount new file mode 100644 index 000000000..bc9012d2d --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/var-lib-NetworkManager.mount @@ -0,0 +1,14 @@ +[Unit] +Description=NetworkManager persistent data +Requires=mnt-data.mount +After=mnt-data.mount +Before=NetworkManager.service + +[Mount] +What=/mnt/overlay/var/lib/NetworkManager +Where=/var/lib/NetworkManager +Type=none +Options=bind + +[Install] +WantedBy=hassos-bind.target diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/var-lib-docker.mount b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/var-lib-docker.mount index e2f76c401..2f262e904 100644 --- a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/var-lib-docker.mount +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/var-lib-docker.mount @@ -1,6 +1,6 @@ [Unit] Description=Docker persistent data -Requires=mnt-data.mount docker.service +Requires=mnt-data.mount After=mnt-data.mount Before=docker.service diff --git a/buildroot-external/rootfs-overlay/usr/sbin/hassos-cli b/buildroot-external/rootfs-overlay/usr/sbin/hassos-cli index 72ffac972..aecb62d08 100755 --- a/buildroot-external/rootfs-overlay/usr/sbin/hassos-cli +++ b/buildroot-external/rootfs-overlay/usr/sbin/hassos-cli @@ -6,7 +6,6 @@ CONFIG_FILE=/mnt/data/hassos.json CLI="$(jq --raw-output '.cli' ${CONFIG_FILE})" DOCKER_ARGS="$(jq --raw-output '.cli_args // empty' ${CONFIG_FILE})" APPARMOR="$(jq --raw-output '.cli_apparmor // "docker-default"' ${CONFIG_FILE})" -MACHINE_ID="$(cat /etc/machine-id)" CLI_DATA=/mnt/data/cli mkdir -p ${CLI_DATA} @@ -16,7 +15,7 @@ docker run \ --rm -ti --init \ --security-opt apparmor="${APPARMOR}" \ -v ${CLI_DATA}:/data \ - -e MACHINE_ID=${MACHINE_ID} \ + -v /etc/machine-id:/etc/machine-id:ro \ $DOCKER_ARGS \ ${CLI} diff --git a/buildroot-external/rootfs-overlay/usr/sbin/hassos-config b/buildroot-external/rootfs-overlay/usr/sbin/hassos-config index 583ce2991..99c295520 100755 --- a/buildroot-external/rootfs-overlay/usr/sbin/hassos-config +++ b/buildroot-external/rootfs-overlay/usr/sbin/hassos-config @@ -1,10 +1,15 @@ #!/bin/sh +if ! findfs LABEL="CONFIG" > /dev/null; then + echo "[Warning] No config partition found" + exit 0 +fi + # Mount config folder systemctl start mnt-config.mount if ! systemctl -q is-active mnt-config.mount; then - echo "[Warning] No config partition found" - exit 0 + echo "[Error] Can't mount config partition" + exit 1 fi ## @@ -14,6 +19,7 @@ if [ -d /mnt/config/network ]; then rm -rf /etc/NetworkManager/system-connections/* cp -f /mnt/config/network/* /etc/NetworkManager/system-connections/ + chmod 600 /etc/NetworkManager/system-connections/* nmcli con reload fi @@ -29,25 +35,31 @@ fi ## # SSH know hosts -if [ -f /mnt/config/known_hosts ]; then - echo "[Info] Update SSH known_hosts!" +if [ -f /mnt/config/authorized_keys ]; then + echo "[Info] Update SSH authorized_keys!" - cp -f /mnt/config/known_hosts /root/.ssh/known_hosts - chmod 600 /root/.ssh/known_hosts + cp -f /mnt/config/authorized_keys /root/.ssh/authorized_keys + chmod 600 /root/.ssh/authorized_keys systemctl start dropbear else - rm -f /root/.ssh/known_hosts + rm -f /root/.ssh/authorized_keys systemctl stop dropbear fi ## # Firmware update -if ls /mnt/config/*.raucb > /dev/null; then +UPTIME=$(awk '{printf "%0.f", $1}' /proc/uptime) +if ls /mnt/config/*.raucb > /dev/null && [ ${UPTIME} -ge 180 ]; then echo "[Info] Performe a firmware update" rauc_filename=$(ls /mnt/config/*.raucb | head -n 1) - rauc install /mnt/config/$rauc_filename + if rauc install ${rauc_filename}; then + echo "[Info] Firmware update success" + systemctl reboot + else + echo "[Error] Firmware update fails" + fi fi # Cleanup config partition diff --git a/buildroot-external/rootfs-overlay/usr/sbin/hassos-persists-journald b/buildroot-external/rootfs-overlay/usr/sbin/hassos-persists-journald new file mode 100755 index 000000000..c9d84598a --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/sbin/hassos-persists-journald @@ -0,0 +1,21 @@ +#!/bin/sh +set -e + +MACHINE_ID=$(cat /etc/machine-id) +CURRENT_LOGS=/var/log/journal/${MACHINE_ID} + +# Loop all logs folder and move +for log_folder in /var/log/journal/*; do + # Not a log folder + if [ ! -d ${log_folder} ]; then + continue + fi + + # Current log folder + if (echo ${log_folder} | grep ${MACHINE_ID}); then + continue + fi + + rm -rf ${log_folder} +done + diff --git a/buildroot-external/rootfs-overlay/usr/sbin/hassos-rate b/buildroot-external/rootfs-overlay/usr/sbin/hassos-rate index 79bbe662a..517b652de 100755 --- a/buildroot-external/rootfs-overlay/usr/sbin/hassos-rate +++ b/buildroot-external/rootfs-overlay/usr/sbin/hassos-rate @@ -15,12 +15,12 @@ function mark_bad() { #### Check system #### # Docker state -if ! systemctl -q is-active docker; then +if systemctl -q is-failed docker; then mark_bad fi # Docker state -if ! systemctl -q is-active hassos-supervisor; then +if systemctl -q is-failed hassos-supervisor; then mark_bad fi diff --git a/buildroot-external/rootfs-overlay/usr/sbin/hassos-supervisor b/buildroot-external/rootfs-overlay/usr/sbin/hassos-supervisor index 04f830e7c..e614a1454 100755 --- a/buildroot-external/rootfs-overlay/usr/sbin/hassos-supervisor +++ b/buildroot-external/rootfs-overlay/usr/sbin/hassos-supervisor @@ -7,7 +7,6 @@ CONFIG_FILE=/mnt/data/hassos.json SUPERVISOR="$(jq --raw-output '.supervisor' ${CONFIG_FILE})" DOCKER_ARGS="$(jq --raw-output '.supervisor_args // empty' ${CONFIG_FILE})" APPARMOR="$(jq --raw-output '.supervisor_apparmor // "docker-default"' ${CONFIG_FILE})" -MACHINE_ID="$(cat /etc/machine-id)" # Init supervisor HASSOS_DATA=/mnt/data/supervisor @@ -25,10 +24,10 @@ runSupervisor() { --security-opt apparmor="${APPARMOR}" \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/dbus:/var/run/dbus \ + -v /etc/machine-id:/etc/machine-id:ro \ -v ${HASSOS_DATA}:/data \ -e SUPERVISOR_SHARE=${HASSOS_DATA} \ -e SUPERVISOR_NAME=hassos_supervisor \ - -e MACHINE_ID=${MACHINE_ID} \ $DOCKER_ARGS \ ${SUPERVISOR} } diff --git a/buildroot-external/rootfs-overlay/usr/share/system-connections/default b/buildroot-external/rootfs-overlay/usr/share/system-connections/default new file mode 100644 index 000000000..510318b1f --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/share/system-connections/default @@ -0,0 +1,11 @@ +[connection] +id=HassOS default +uuid=f62bf7c2-e565-49ff-bbfc-a4cf791e6add +type=802-3-ethernet + +[ipv4] +method=auto + +[ipv6] +addr-gen-mode=stable-privacy +method=auto diff --git a/buildroot-external/scripts/rootfs-layer.sh b/buildroot-external/scripts/rootfs-layer.sh index 47243cfb5..45f2918fc 100644 --- a/buildroot-external/scripts/rootfs-layer.sh +++ b/buildroot-external/scripts/rootfs-layer.sh @@ -2,10 +2,6 @@ function fix_rootfs() { - # Cleanup DHCP service, we don't need this with NetworkManager - rm -rf ${TARGET_DIR}/etc/systemd/system/multi-user.target.wants/dhcpcd.service - rm -rf ${TARGET_DIR}/usr/lib/systemd/system/dhcpcd.service - # Cleanup etc rm -rf ${TARGET_DIR}/etc/init.d rm -rf ${TARGET_DIR}/etc/network @@ -20,6 +16,9 @@ function fix_rootfs() { # Cleanup miscs rm -rf ${TARGET_DIR}/usr/lib/modules-load.d + # Fix: permission for system connection files + chmod 600 ${TARGET_DIR}/usr/share/system-connections/* + # Fix: tempfs with /srv sed -i "/srv/d" ${TARGET_DIR}/usr/lib/tmpfiles.d/home.conf @@ -31,4 +30,8 @@ function fix_rootfs() { function install_hassos_cli() { sed -i "s|\(root.*\)/bin/sh|\1/usr/sbin/hassos-cli|" ${TARGET_DIR}/etc/passwd + + if ! grep "hassos-cli" ${TARGET_DIR}/etc/shells; then + echo "/usr/sbin/hassos-cli" >> ${TARGET_DIR}/etc/shells + fi } diff --git a/buildroot-patches/0007-NetworkManager_wpa-supplicant.patch b/buildroot-patches/0007-NetworkManager_wpa-supplicant.patch new file mode 100644 index 000000000..9ecf97644 --- /dev/null +++ b/buildroot-patches/0007-NetworkManager_wpa-supplicant.patch @@ -0,0 +1,43 @@ +From 22a39b0058643c9aebdaf3ebc42a1ea30a33522f Mon Sep 17 00:00:00 2001 +From: Pascal Vizeli +Date: Sat, 30 Jun 2018 21:10:14 +0000 +Subject: [PATCH 1/1] NetworkManager_wpa-supplicant + +Signed-off-by: Pascal Vizeli +--- + package/network-manager/Config.in | 5 +++-- + package/network-manager/network-manager.mk | 2 +- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/package/network-manager/Config.in b/package/network-manager/Config.in +index 72658c1278..759e4a98f9 100644 +--- a/package/network-manager/Config.in ++++ b/package/network-manager/Config.in +@@ -16,8 +16,9 @@ config BR2_PACKAGE_NETWORK_MANAGER + select BR2_PACKAGE_LIBGUDEV + select BR2_PACKAGE_UTIL_LINUX + select BR2_PACKAGE_UTIL_LINUX_LIBUUID +- select BR2_PACKAGE_WIRELESS_TOOLS +- select BR2_PACKAGE_WIRELESS_TOOLS_LIB ++ select BR2_PACKAGE_WPA_SUPPLICANT ++ select BR2_PACKAGE_WPA_SUPPLICANT_DBUS_NEW ++ select BR2_PACKAGE_WPA_SUPPLICANT_DBUS_INTROSPECTION + select BR2_PACKAGE_READLINE + select BR2_PACKAGE_LIBNDP + help +diff --git a/package/network-manager/network-manager.mk b/package/network-manager/network-manager.mk +index a520aad9c0..846605eb8e 100644 +--- a/package/network-manager/network-manager.mk ++++ b/package/network-manager/network-manager.mk +@@ -10,7 +10,7 @@ NETWORK_MANAGER_SOURCE = NetworkManager-$(NETWORK_MANAGER_VERSION).tar.xz + NETWORK_MANAGER_SITE = http://ftp.gnome.org/pub/GNOME/sources/NetworkManager/$(NETWORK_MANAGER_VERSION_MAJOR) + NETWORK_MANAGER_INSTALL_STAGING = YES + NETWORK_MANAGER_DEPENDENCIES = host-pkgconf udev dbus-glib libnl gnutls \ +- libgcrypt wireless_tools util-linux host-intltool readline libndp libgudev ++ libgcrypt wpa_supplicant util-linux host-intltool readline libndp libgudev + NETWORK_MANAGER_LICENSE = GPL-2.0+ (app), LGPL-2.0+ (libnm-util) + NETWORK_MANAGER_LICENSE_FILES = COPYING libnm-util/COPYING + +-- +2.17.1 + diff --git a/buildroot-patches/0008-Fix-dhcp-client.patch b/buildroot-patches/0008-Fix-dhcp-client.patch new file mode 100644 index 000000000..b66173e23 --- /dev/null +++ b/buildroot-patches/0008-Fix-dhcp-client.patch @@ -0,0 +1,27 @@ +From 07169ea27b84230299685f84031f07f8af74dbb4 Mon Sep 17 00:00:00 2001 +From: Pascal Vizeli +Date: Wed, 4 Jul 2018 20:31:14 +0000 +Subject: [PATCH 1/1] Fix dhcp client + +Signed-off-by: Pascal Vizeli +--- + package/dhcp/dhcp.mk | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/package/dhcp/dhcp.mk b/package/dhcp/dhcp.mk +index a1285184d3..7ea7589a28 100644 +--- a/package/dhcp/dhcp.mk ++++ b/package/dhcp/dhcp.mk +@@ -75,8 +75,7 @@ endif + + ifeq ($(BR2_PACKAGE_DHCP_CLIENT),y) + define DHCP_INSTALL_CLIENT +- mkdir -p $(TARGET_DIR)/var/lib +- (cd $(TARGET_DIR)/var/lib; ln -snf /tmp dhcp) ++ mkdir -p $(TARGET_DIR)/var/lib/dhcp + $(INSTALL) -m 0755 -D $(DHCP_DIR)/client/dhclient \ + $(TARGET_DIR)/sbin/dhclient + $(INSTALL) -m 0644 -D package/dhcp/dhclient.conf \ +-- +2.17.1 + diff --git a/buildroot-patches/0009-NetworkManager-allow-to-wait-on-boot.patch b/buildroot-patches/0009-NetworkManager-allow-to-wait-on-boot.patch new file mode 100644 index 000000000..273dd981a --- /dev/null +++ b/buildroot-patches/0009-NetworkManager-allow-to-wait-on-boot.patch @@ -0,0 +1,34 @@ +From 590565bc07f563f978004727dc817dc89527377a Mon Sep 17 00:00:00 2001 +From: Pascal Vizeli +Date: Sat, 31 Mar 2018 16:58:14 +0200 +Subject: [PATCH 1/1] NetworkManager: allow to wait on boot + +Signed-off-by: Pascal Vizeli +--- + package/network-manager/network-manager.mk | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/package/network-manager/network-manager.mk b/package/network-manager/network-manager.mk +index a520aad..fb2012a 100644 +--- a/package/network-manager/network-manager.mk ++++ b/package/network-manager/network-manager.mk +@@ -93,6 +93,7 @@ endef + + define NETWORK_MANAGER_INSTALL_INIT_SYSTEMD + mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants ++ mkdir -p $(TARGET_DIR)/etc/systemd/system/network-online.target.wants + + ln -sf /usr/lib/systemd/system/NetworkManager.service \ + $(TARGET_DIR)/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service +@@ -100,6 +101,9 @@ define NETWORK_MANAGER_INSTALL_INIT_SYSTEMD + ln -sf /usr/lib/systemd/system/NetworkManager.service \ + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/NetworkManager.service + ++ ln -sf /usr/lib/systemd/system/NetworkManager-wait-online.service \ ++ $(TARGET_DIR)/etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service ++ + ln -sf /usr/lib/systemd/system/NetworkManager-dispatcher.service \ + $(TARGET_DIR)/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service + endef +-- +2.7.4 diff --git a/buildroot/package/dhcp/dhcp.mk b/buildroot/package/dhcp/dhcp.mk index a1285184d..7ea7589a2 100644 --- a/buildroot/package/dhcp/dhcp.mk +++ b/buildroot/package/dhcp/dhcp.mk @@ -75,8 +75,7 @@ endif ifeq ($(BR2_PACKAGE_DHCP_CLIENT),y) define DHCP_INSTALL_CLIENT - mkdir -p $(TARGET_DIR)/var/lib - (cd $(TARGET_DIR)/var/lib; ln -snf /tmp dhcp) + mkdir -p $(TARGET_DIR)/var/lib/dhcp $(INSTALL) -m 0755 -D $(DHCP_DIR)/client/dhclient \ $(TARGET_DIR)/sbin/dhclient $(INSTALL) -m 0644 -D package/dhcp/dhclient.conf \ diff --git a/buildroot/package/network-manager/Config.in b/buildroot/package/network-manager/Config.in index 72658c127..759e4a98f 100644 --- a/buildroot/package/network-manager/Config.in +++ b/buildroot/package/network-manager/Config.in @@ -16,8 +16,9 @@ config BR2_PACKAGE_NETWORK_MANAGER select BR2_PACKAGE_LIBGUDEV select BR2_PACKAGE_UTIL_LINUX select BR2_PACKAGE_UTIL_LINUX_LIBUUID - select BR2_PACKAGE_WIRELESS_TOOLS - select BR2_PACKAGE_WIRELESS_TOOLS_LIB + select BR2_PACKAGE_WPA_SUPPLICANT + select BR2_PACKAGE_WPA_SUPPLICANT_DBUS_NEW + select BR2_PACKAGE_WPA_SUPPLICANT_DBUS_INTROSPECTION select BR2_PACKAGE_READLINE select BR2_PACKAGE_LIBNDP help diff --git a/buildroot/package/network-manager/network-manager.mk b/buildroot/package/network-manager/network-manager.mk index a520aad9c..b07059f79 100644 --- a/buildroot/package/network-manager/network-manager.mk +++ b/buildroot/package/network-manager/network-manager.mk @@ -10,7 +10,7 @@ NETWORK_MANAGER_SOURCE = NetworkManager-$(NETWORK_MANAGER_VERSION).tar.xz NETWORK_MANAGER_SITE = http://ftp.gnome.org/pub/GNOME/sources/NetworkManager/$(NETWORK_MANAGER_VERSION_MAJOR) NETWORK_MANAGER_INSTALL_STAGING = YES NETWORK_MANAGER_DEPENDENCIES = host-pkgconf udev dbus-glib libnl gnutls \ - libgcrypt wireless_tools util-linux host-intltool readline libndp libgudev + libgcrypt wpa_supplicant util-linux host-intltool readline libndp libgudev NETWORK_MANAGER_LICENSE = GPL-2.0+ (app), LGPL-2.0+ (libnm-util) NETWORK_MANAGER_LICENSE_FILES = COPYING libnm-util/COPYING @@ -93,6 +93,7 @@ endef define NETWORK_MANAGER_INSTALL_INIT_SYSTEMD mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants + mkdir -p $(TARGET_DIR)/etc/systemd/system/network-online.target.wants ln -sf /usr/lib/systemd/system/NetworkManager.service \ $(TARGET_DIR)/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service @@ -100,6 +101,9 @@ define NETWORK_MANAGER_INSTALL_INIT_SYSTEMD ln -sf /usr/lib/systemd/system/NetworkManager.service \ $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/NetworkManager.service + ln -sf /usr/lib/systemd/system/NetworkManager-wait-online.service \ + $(TARGET_DIR)/etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service + ln -sf /usr/lib/systemd/system/NetworkManager-dispatcher.service \ $(TARGET_DIR)/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service endef diff --git a/scripts/build-all.sh b/scripts/build-all.sh index f3d075243..5f99638a5 100755 --- a/scripts/build-all.sh +++ b/scripts/build-all.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -mkdir -p /build/RL +mkdir -p /build/release all_platforms=(ova rpi rpi0_w rpi2 rpi3 rpi3_64) for platform in "${all_platforms[@]}"; do diff --git a/scripts/upload-rel.sh b/scripts/upload-rel.sh new file mode 100755 index 000000000..6fcb3663a --- /dev/null +++ b/scripts/upload-rel.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -e + +if [ -z "${1}" ] || [ -z "${2}" ]; then + echo "[Error] Parameter error" + exit 1 +fi + +# Define variables. +GH_API="https://api.github.com" +GH_REPO="$GH_API/repos/home-assistant/hassos" +GH_TAGS="$GH_REPO/releases/tags/${2}" +AUTH="Authorization: token ${1}" + +# Validate token. +if ! curl -o /dev/null -sH "$AUTH" $GH_REPO; then + echo "[Error] Invalid repo, token or network issue!" + exit 1 +fi + +# Read asset tags. +id=$(curl -sH "$AUTH" $GH_TAGS | jq -e ".id // empty") + +# Get ID of the asset based on given filename. +if [ -z "$id" ]; then + echo "[Error] Failed to get release id for tag: ${2}" + exit 1 +fi + +# Upload asset +echo "[Info] Start Uploading asset... " + +for filename in release/*; do + echo "[Info] Start upload ${filename}" + + # Construct url + GH_ASSET="https://uploads.github.com/repos/home-assistant/hassos/releases/$id/assets?name=$(basename $filename)" + + curl "$GITHUB_OAUTH_BASIC" --data-binary @"$filename" -H "${AUTH}" -H "Content-Type: application/octet-stream" $GH_ASSET + + echo "[Info] Upload ${filename} done" +done +