This file is indexed.

/usr/sbin/ocs-gen-grub2-efi-bldr is in clonezilla 3.10.11-3.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
# Author: Steven Shiau <steven _at_ nchc org tw>
# License: GPL
# Program to create the EFI boot loader from grub2

# Settings
# Load DRBL setting and functions
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"

. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions

efi_required_mod="part_gpt part_msdos hfsplus fat ext2 ntfs btrfs normal chain boot configfile linux appleldr minicmd multiboot iso9660 acpi efi_gop efi_uga elf loadbios loopback video_fb usb search fixvideo png gfxterm gfxterm_background gfxterm_menu echo videotest video pci reboot halt gfxmenu gettext"
grub_required_files="/usr/share/grub/unicode.pf2"

# Functions
USAGE() {
  echo "To create an EFI boot loader from grub2."
  echo "Usage: $ocs OUTPUT_DIR"
  echo "OUTPUT_DIR is the where the created boot loader will be placed."
  echo "   E.g.  $ocs /tmp/efi/"
} # end of USAGE
#
#############
###  MAIN ###
#############
#
ocs=`basename $0`
check_if_root

#
while [ $# -gt 0 ]; do
 case "$1" in
   -*)     echo "${0}: ${1}: invalid option" >&2
           USAGE >& 2
           exit 2 ;;
   *)      break ;;
 esac
done

output_dir="$1"

# Checking
if [ ! -e /etc/debian_version ]; then
  [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
  echo "This is not a Debian/Ubuntu Linux system. This program only works on Debian/Ubuntu Linux system."
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo "Program terminated!"
  exit 1
fi
if [ -z "$output_dir" ]; then
  [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
  echo "No output dir! Program terminated!"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  USAGE
  exit 1
fi
if [ ! -d "$output_dir" ]; then
  [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
  echo "The output dir \"$output_dir\" does not exist, or it's not a directory."
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo "Program terminated!"
  exit 1
fi

#
grub_efi_dir="$(mktemp -d /tmp/grub-efi.XXXXXX)"
for i in grub-efi-ia32 grub-efi-ia32-bin grub-efi-amd64 grub-efi-amd64-bin; do
  echo "Download $i from deb packages repository..."
  LC_ALL=C apt-get -d --reinstall -y install $i &>/dev/null
done
for i in /var/cache/apt/archives/grub-efi*.deb; do
  dpkg --extract $i $grub_efi_dir
done
# Prepare a grub.cfg so that the eltorito image could find it.
cat <<-GRUB_END > $grub_efi_dir/grub_head.cfg
search --file --set=root /.disk/info
set prefix=(\$root)/EFI/boot/

GRUB_END

# Check if xz compression is supported by grub-mkimage. If yes, use it. The prompt should look like:
# -C, --compression=(xz|none|auto)  choose the compression to use
grub_mkimg_compress_opt=""
if [ -n "$(LC_ALL=C grub-mkimage --help 2>&1 | grep -Ew -- "-C" | grep -iw xz)" ]; then
  # Even if grub-mkimage --help shows "-C xz" support, it still be possible that it actually lacks XZ support.
  # Ref: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=692246
  # Therefore we test here. When #692246 is fixed, we can remove this testing.
  if LC_ALL=C grub-mkimage -C xz -O i386-efi -o /dev/null &>/dev/null; then
    grub_mkimg_compress_opt="-C xz"
  fi
fi
#
for i in i386 x86_64; do
  export EFI_ARCH=$i
  case "$EFI_ARCH" in
    i386)   out_f="$output_dir/bootia32.efi" ;;
    x86_64) out_f="$output_dir/bootx64.efi" ;;
  esac
  # Checking the required modules
  for im in $efi_required_mod; do
    if [ ! -e "$grub_efi_dir/usr/lib/grub/$EFI_ARCH-efi/${im}.mod" ]; then
      [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
      echo "Missing grub2 module ${im}.mod... Exluding ${im}.mod..."
      [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
      efi_required_mod="$(echo $efi_required_mod | sed -r -e "s/$im //g")"
    fi
  done
  grub-mkimage $grub_mkimg_compress_opt -O $EFI_ARCH-efi -d $grub_efi_dir/usr/lib/grub/$EFI_ARCH-efi/ -o $out_f --prefix=/EFI/boot/ -c $grub_efi_dir/grub_head.cfg $efi_required_mod
  rc=$?
  if [ "$rc" -gt 0 ]; then
    # When grub-mkimage fails, an empty output file will still be created. We'd better to clean it.
    rm -f $out_f
  fi
done
# Copy the required files, e.g. fonts to the output dir.
cp -a $grub_required_files $output_dir

# Clean the temp dir
if [ -e "$grub_efi_dir" -a -n "$(echo $grub_efi_dir | grep -E "grub-efi")" ]; then
  rm -rf $grub_efi_dir
fi