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() { ln -sf /etc/systemd/system/$1 "${TARGET_DIR}/usr/lib/systemd/system/multi-user.target.wants/$1" }