diff options
| author | Sébastien Dailly <sebastien@dailly.me> | 2026-05-30 09:58:45 +0200 |
|---|---|---|
| committer | Sébastien Dailly <sebastien@dailly.me> | 2026-05-30 09:58:45 +0200 |
| commit | 8b2420f74367e4973be0dd9556c021588abfe591 (patch) | |
| tree | b95fbf8d5aefc51f619b2506d8ae75ee9f29b75b /board/common/common.sh | |
Initial commit
Diffstat (limited to 'board/common/common.sh')
| -rw-r--r-- | board/common/common.sh | 28 |
1 files changed, 28 insertions, 0 deletions
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" +} |
