From 8b2420f74367e4973be0dd9556c021588abfe591 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Sat, 30 May 2026 09:58:45 +0200 Subject: Initial commit --- board/common/common.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 board/common/common.sh (limited to 'board/common/common.sh') diff --git a/board/common/common.sh b/board/common/common.sh new file mode 100644 index 0000000..ee1af1f --- /dev/null +++ b/board/common/common.sh @@ -0,0 +1,28 @@ +create_missing_dir() { + echo "creating directory ${TARGET_DIR}/$1" + test -d "${TARGET_DIR}/$1" || mkdir -p "${TARGET_DIR}/$1" +} + +remove_text() { + echo sed --in-place "s/$2//" $1 + sed --in-place "s/$2//" $1 +} + +add_tmpfs() { + create_missing_dir "$1" + if ! grep -q "$1" "${TARGET_DIR}/etc/fstab"; then + cat << __EOF__ >> "${TARGET_DIR}/etc/fstab" +tmpfs $1 tmpfs rw 0 0 +__EOF__ + fi +} + +# Enable a systemd service +enable_service() { + if [ -e "$BR2_EXTERNAL_BASTION_PATH/local/services/$1" ]; then + cp "$BR2_EXTERNAL_BASTION_PATH/local/services/$1" "${TARGET_DIR}/etc/systemd/system/$1" + else + echo "WARN: local/services/$1 does not exists" + fi + ln -sf /etc/systemd/system/$1 "${TARGET_DIR}/usr/lib/systemd/system/multi-user.target.wants/$1" +} -- cgit v1.2.3