00-entry-directory.install 748 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env bash
  2. # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
  3. # ex: ts=8 sw=4 sts=4 et filetype=sh
  4. COMMAND="$1"
  5. KERNEL_VERSION="$2"
  6. ENTRY_DIR_ABS="$3"
  7. KERNEL_IMAGE="$4"
  8. INITRD_OPTIONS_START="5"
  9. if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
  10. exit 0
  11. fi
  12. if [[ $COMMAND != add ]]; then
  13. exit 0
  14. fi
  15. # If the boot dir exists (e.g. $ESP/<machine-id>),
  16. # create the entry directory ($ESP/<machine-id>/<kernel-version>).
  17. # This is the only function of this plugin.
  18. MACHINE_ID_DIR="${ENTRY_DIR_ABS%/*}"
  19. if ! [ -d "$MACHINE_ID_DIR" ]; then
  20. exit 0
  21. fi
  22. if [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ]; then
  23. echo "+mkdir -v -p $ENTRY_DIR_ABS"
  24. exec mkdir -v -p "$ENTRY_DIR_ABS"
  25. else
  26. exec mkdir -p "$ENTRY_DIR_ABS"
  27. fi