This file is indexed.

/usr/bin/cloud-init-per is in cloud-init 0.7.6~bzr976-2.

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
#!/bin/sh

DATA_PRE="/var/lib/cloud/sem/bootper"
INST_PRE="/var/lib/cloud/instance/sem/bootper"

Usage() {
   cat <<EOF
Usage: ${0##*/} frequency name cmd [ arg1 [ arg2 [ ... ] ]
   run cmd with arguments provided.

   This utility can make it easier to use boothooks or bootcmd
   on a per "once" or "always" basis.

   If frequency is:
      * once: run only once (do not re-run for new instance-id)
      * instance: run only the first boot for a given instance-id
      * always: run every boot

EOF
}
error() { echo "$@" 1>&2; }
fail() { [ $# -eq 0 ] || error "$@"; exit 1; }

# support the old 'cloud-init-run-module freq name "execute" cmd arg1'
# if < 3 arguments, it will fail below on usage.
if [ "${0##*/}" = "cloud-init-run-module" ]; then
   if [ $# -le 2 -o "$3" = "execute" ]; then
      error "Warning: ${0##*/} is deprecated. Please use cloud-init-per."
      freq=$1; name=$2; 
      [ $# -le 2 ] || shift 3;
      set -- "$freq" "$name" "$@"
   else
      fail "legacy cloud-init-run-module only supported with module 'execute'"
   fi
fi

[ "$1" = "-h" -o "$1" = "--help" ] && { Usage ; exit 0; }
[ $# -ge 3 ] || { Usage 1>&2; exit 1; }
freq=$1
name=$2
shift 2;

[ "${name#*/}" = "${name}" ] || fail "name cannot contain a /"
[ "$(id -u)" = "0" ] || fail "must be root"

case "$freq" in
   once|always) sem="${DATA_PRE}.$name.$freq";;
   instance) sem="${INST_PRE}.$name.$freq";;
   *) Usage 1>&2; fail "invalid frequency: $freq";;
esac

[ -d "${sem%/*}" ] || mkdir -p "${sem%/*}" ||
   fail "failed to make directory for ${sem}"

[ "$freq" != "always" -a -e "$sem" ] && exit 0
"$@"
ret=$?
printf "%s\t%s\n" "$ret" "$(date +%s)" > "$sem" ||
   fail "failed to write to $sem"
exit $ret