From 404e861a272ae45cff37592fe6e89cf5a4f33463 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 10 May 2018 22:33:18 +0200 Subject: [PATCH] some cleanups --- buildroot-external/board/ova/post-build.sh | 11 ----------- buildroot-external/configs/ova_defconfig | 3 ++- .../rootfs-overlay/usr/{bin => sbin}/hassio-cli | 0 buildroot-external/scripts/post-build.sh | 7 +++++++ buildroot-external/scripts/rootfs_layer.sh | 15 ++++++++++++++- 5 files changed, 23 insertions(+), 13 deletions(-) delete mode 100755 buildroot-external/board/ova/post-build.sh rename buildroot-external/rootfs-overlay/usr/{bin => sbin}/hassio-cli (100%) create mode 100755 buildroot-external/scripts/post-build.sh diff --git a/buildroot-external/board/ova/post-build.sh b/buildroot-external/board/ova/post-build.sh deleted file mode 100755 index d0d71ed75..000000000 --- a/buildroot-external/board/ova/post-build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -set -e - -SCRIPT_DIR=${BR2_EXTERNAL_HASSIO_PATH}/scripts -BOARD_DIR="$(dirname $0)" - -. ${SCRIPT_DIR}/rootfs_layer.sh - -# HassioOS tasks -fix_rootfs -install_hassio_cli diff --git a/buildroot-external/configs/ova_defconfig b/buildroot-external/configs/ova_defconfig index 4415acbdf..62f4d4ca0 100644 --- a/buildroot-external/configs/ova_defconfig +++ b/buildroot-external/configs/ova_defconfig @@ -11,8 +11,9 @@ BR2_INIT_SYSTEMD=y BR2_TARGET_GENERIC_GETTY_PORT="tty1" # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_HASSIO_PATH)/rootfs-overlay $(BR2_EXTERNAL_HASSIO_PATH)/board/ova/rootfs-overlay" -BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_HASSIO_PATH)/board/ova/post-build.sh" +BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_HASSIO_PATH)/scripts/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSIO_PATH)/board/ova/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="ova" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_HASSIO_PATH)/board/ova/kernel.config" diff --git a/buildroot-external/rootfs-overlay/usr/bin/hassio-cli b/buildroot-external/rootfs-overlay/usr/sbin/hassio-cli similarity index 100% rename from buildroot-external/rootfs-overlay/usr/bin/hassio-cli rename to buildroot-external/rootfs-overlay/usr/sbin/hassio-cli diff --git a/buildroot-external/scripts/post-build.sh b/buildroot-external/scripts/post-build.sh new file mode 100755 index 000000000..81eb1a233 --- /dev/null +++ b/buildroot-external/scripts/post-build.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +. rootfs_layer.sh + +# Hass.io OS tasks +fix_rootfs +install_hassio_cli diff --git a/buildroot-external/scripts/rootfs_layer.sh b/buildroot-external/scripts/rootfs_layer.sh index f8bcffccc..f23375d17 100644 --- a/buildroot-external/scripts/rootfs_layer.sh +++ b/buildroot-external/scripts/rootfs_layer.sh @@ -5,10 +5,23 @@ 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/modules-load.d + rm -rf ${TARGET_DIR}/etc/network + rm -rf ${TARGET_DIR}/etc/X11 + rm -rf ${TARGET_DIR}/etc/xdg + rm -f ${TARGET_DIR}/etc/mtab + + # Cleanup root + rm -rf ${TARGET_DIR}/media + rm -rf ${TARGET_DIR}/srv + rm -rf ${TARGET_DIR}/opt } function install_hassio_cli() { - sed -i "s|\(root.*\)/bin/sh|\1/usr/bin/hassio-cli|" ${TARGET_DIR}/etc/passwd + sed -i "s|\(root.*\)/bin/sh|\1/usr/sbin/hassio-cli|" ${TARGET_DIR}/etc/passwd }