This file is indexed.

/usr/bin/virt-p2v-make-disk is in libguestfs-tools 1:1.32.2-4ubuntu2.

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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/bin/bash -
# p2v/virt-p2v-make-disk.  Generated from virt-p2v-make-disk.in by configure.
# virt-p2v-make-disk
# Copyright (C) 2014-2016 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

unset CDPATH

program="virt-p2v-make-disk"
version="1.32.2"

TEMP=`getopt \
        -o o:V \
        --long help,inject-ssh-identity:,output:,version \
        -n $program -- "$@"`
if [ $? != 0 ]; then
    echo "$program: problem parsing the command line arguments"
    exit 1
fi
eval set -- "$TEMP"

output=
upload=

usage ()
{
    echo "Usage:"
    echo "  $program [--options] -o /dev/sdX os-version"
    echo
    echo "Read $program(1) man page for more information."
    exit $1
}

while true; do
    case "$1" in
        --inject-ssh-identity)
            upload="--upload $2:/var/tmp/id_rsa"
            shift 2;;
        -o|--output)
            output="$2"
            shift 2;;
        -V|--version)
            echo "$program $version"
            exit 0;;
        --help)
            usage 0;;
        --)
            shift
            break;;
        *)
            echo "internal error ($1)"
            exit 1;;
    esac
done

if [ -z "$output" ]; then
    echo "$program: You must set the -o (--output) option."
    exit 1
fi

if [ $# -ne 1 ]; then
    echo "$program: Missing os-version.  See $program(1)."
    exit 1
fi

osversion="$1"

# Create a temporary directory and clean it up when we finish.
tmpdir="$(mktemp -d)"
cleanup ()
{
    rm -rf $tmpdir
}
trap cleanup INT QUIT TERM EXIT ERR

# Deal with stupid autotools libexecdir-not-expandable crap.
prefix="/usr"
exec_prefix="${prefix}"
libexecdir="${prefix}/lib/x86_64-linux-gnu"

if [ -n "$VIRT_P2V_DATA_DIR" ]; then
    datadir="$VIRT_P2V_DATA_DIR"
    host_libexecdir="$VIRT_P2V_DATA_DIR"
else
    datadir="${prefix}/share/virt-p2v"
    host_libexecdir="${prefix}/lib/x86_64-linux-gnu"
fi

# Variations depending on the target distro.  The main difference
# is in the list of distro packages we add to the base appliance.
case "$osversion" in
    centos-*|fedora-*|rhel-*|scientificlinux-*)
        depsfile="$datadir/dependencies.redhat"
        cat > $tmpdir/p2v.conf <<'EOF'
add_drivers+=" usb-storage "
EOF
        cat > $tmpdir/post-install <<'EOF'
#!/bin/bash
# Rebuild the initramfs.
latest_version="$(cd /lib/modules; ls -1vr | head -1)"
dracut -f --kver $latest_version
EOF
        # Double quotes because we want $tmpdir to be expanded:
        extra_args="
          --selinux-relabel
          --upload $tmpdir/p2v.conf:/etc/dracut.conf.d/
          --run $tmpdir/post-install
        "
        ;;
    debian-*|ubuntu-*)
        depsfile="$datadir/dependencies.debian"
        ;;
    archlinux-*)
        depsfile="$datadir/dependencies.archlinux"
        ;;
    opensuse-*|suse-*)
        depsfile="$datadir/dependencies.suse"
        ;;
    *)
        echo "$program: internal error: could not work out the Linux distro from '$osversion'"
        exit 1
esac

# Virt-builder requires the dependencies to be comma-separated with
# no spaces.  The $depsfile is one dependency per line.
if [ ! -f "$depsfile" ]; then
    echo "$program: cannot find dependencies file ($depsfile)"
    exit 1
fi
install=
while read line; do
    if [ -n "$line" ]; then
        if [ -z "$install" ]; then
            install="$line"
        else
            install="$install,$line"
        fi
    fi
done < $depsfile

# Run virt-builder.  Note we controversially assume systemd here.  We
# could provide a sysvinit fallback if required.
virt-builder "$osversion"                                       \
    --output "$output"                                          \
    --update                                                    \
    --install "$install"                                        \
    --root-password password:p2v                                \
    --upload "$datadir"/issue:/etc/issue                        \
    --upload "$datadir"/issue:/etc/issue.net                    \
    --mkdir "$libexecdir"                                       \
    --upload "$host_libexecdir"/virt-p2v:"$libexecdir"          \
    --chmod 0755:"$libexecdir"/virt-p2v                         \
    --upload "$datadir"/launch-virt-p2v:/usr/bin/               \
    --chmod 0755:/usr/bin/launch-virt-p2v                       \
    --upload "$datadir"/p2v.service:/etc/systemd/system/        \
    --mkdir /etc/systemd/system/default.target.wants            \
    --link /usr/lib/systemd/system/multi-user.target:/etc/systemd/system/default.target \
    --link /etc/systemd/system/p2v.service:/etc/systemd/system/default.target.wants/p2v.service \
    --edit '/usr/lib/systemd/system/getty@.service:
        s/^ExecStart=(.*)/ExecStart=$1 -a root/
    '                                                           \
    --edit '/etc/systemd/logind.conf:
        s/^[Login]/[Login]\nReserveVT=1\n/
    '                                                           \
    $upload                                                     \
    $extra_args

# We have to do this so the cleanup() handler runs.
exit $?