This file is indexed.

/usr/bin/virt-p2v-make-kiwi is in libguestfs-tools 1:1.36.13-1ubuntu3.

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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#!/bin/bash -
# p2v/virt-p2v-make-kiwi.  Generated from virt-p2v-make-kiwi.in by configure.
# virt-p2v-make-kiwi
# Copyright (C) 2016 SUSE.
#
# 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-kiwi"
version="1.36.13"

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

usage ()
{
    echo "Usage:"
    echo "  $program [--options] [-o kiwi-folder]"
    echo
    echo "Read $program(1) man page for more information."
    exit $1
}

output=p2v.kiwi
ssh_identity=

while true; do
    case "$1" in
        --inject-ssh-identity)
            ssh_identity="$2"
            shift 2;;
        -o|--output)
            output="$2"
            shift 2;;

        # help etc.
        --help)
            usage 0;;
        -V|--version)
            echo "$program $version"
            exit 0;;
        --short-options)
            echo -n "$shortopts" |
                /bin/sed -e 's/://g' -e 's/\(.\)/-\1\n/g'
            exit 0;;
        --long-options)
            echo "$longopts" |
                /bin/sed -e 's/,/\n/g' -e 's/:$//mg' -e 's/\(.*\)/--\1/mg' |
                grep -v -E -- "--(short|long)-options"
            exit 0;;
        --)
            shift
            break;;
        *)
            echo "internal error ($1)"
            exit 1;;
    esac
done

set -e

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

# Dependencies.  Since kiwi is SUSE-specific, only include
# dependencies.suse here.
depsfile="$datadir/dependencies.suse"
if [ ! -f "$depsfile" ]; then
    echo "$0: cannot find dependencies file ($depsfile)"
    exit 1
fi
dependencies=
while read line; do
    if [ -n "$line" ]; then
        depname=$(echo $line | awk '{gsub(/ /, "", $0); print}')
        pkg="    <package name=\"$depname\"/>"
        if [ -z "$dependencies" ]; then
            dependencies="$pkg"
        else
            dependencies="$dependencies
$pkg"
        fi
    fi
done < $depsfile

# Compute the distro-dependent pieces for kiwi
branding=
release_pkg=
base_pattern=
kiwi_boot=
repos=
. /etc/os-release
case "$NAME" in
    SLES)
        branding="SLE"
        release_pkg="sles-release"
        base_pattern="patterns-sles-Minimal"
        case "$VERSION_ID" in
            12)
                kiwi_boot="SLES12"
                repos="http://download.suse.de/ibs/SUSE:/SLE-12:/Update/standard
                      http://download.suse.de/ibs/SUSE:/SLE-12:/GA/standard"
                ;;
            12.1)
                kiwi_boot="SLES12"
                repos="http://download.suse.de/ibs/SUSE:/SLE-12-SP1:/Update/standard
                      http://download.suse.de/ibs/SUSE:/SLE-12-SP1:/GA/standard
                      http://download.suse.de/ibs/SUSE:/SLE-12:/Update/standard
                      http://download.suse.de/ibs/SUSE:/SLE-12:/GA/standard"
                ;;
            *)
                echo "Unsupported distribution $NAME $VERSION_ID"
                exit 1;;
        esac;;
    openSUSE*)
        branding="openSUSE"
        release_pkg="openSUSE-release"
        base_pattern="patterns-openSUSE-base"
        case "$VERSION" in
            13.1\ *)
                kiwi_boot="13.1"
                repos="obs://13.1/repo/oss"
                ;;
            13.2\ *)
                kiwi_boot="13.2"
                repos="obs://13.2/repo/oss"
                ;;
            42.1)
                kiwi_boot="leap42.1"
                repos="obs://leap/42.1/repo/oss"
                ;;
            *\ \(Tumbleweed\))
                kiwi_boot="leap42.1"
                repos="obs://openSUSE:Factory/standard"
                ;;
            *)
                echo "Unsupported distribution $NAME $VERSION_ID"
                exit 1;;
        esac;;
    *)
        echo "Unsupported distribution $NAME $VERSION"
        exit 1;;
esac

# Compute the repos
repos_xml=
for repo in $repos; do
    repos_xml="  <repository type=\"rpm-md\">\n    <source path=\"$repo\"/>\n  </repository>\n$repos_xml"
done

mkdir $output
cp $datadir/kiwi-config.sh $output/config.sh

mkdir -p $output/root/etc/sysconfig/network
cat >$output/root/etc/sysconfig/network/ifcfg-eth0 << EOF
BOOTPROTO='dhcp'
MTU=''
REMOTE_IPADDR=''
STARTMODE='onboot'
EOF

mkdir -p $output/root/etc/systemd/system
cp $datadir/p2v.service $output/root/etc/systemd/system

mkdir -p $output/root/etc/udev/rules.d
cat >$output/root/etc/udev/rules.d/70-persistent-net.rules <<EOF
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="?*", NAME="eth0"
EOF

cp $datadir/issue $output/root/etc/issue

mkdir -p $output/root/usr/bin
cp $datadir/launch-virt-p2v $output/root/usr/bin
xzcat $libdir/virt-p2v.xz > $output/root/usr/bin/virt-p2v

if test "z$ssh_identity" != "z"; then
    mkdir -p $output/root/var/tmp
    cp $ssh_identity $output/root/var/tmp/id_rsa
    chmod 0600 $output/root/var/tmp/id_rsa
fi

# Now generate the final kiwi config, substituting as necessary.
gawk \
  -v "dependencies=$dependencies" \
  -v "md5sum_virt_p2v=$md5sum_virt_p2v" \
  -v "branding=$branding" \
  -v "release_pkg=$release_pkg" \
  -v "base_pattern=$base_pattern" \
  -v "kiwi_boot=$kiwi_boot" \
  -v "repos=$repos_xml" \
  '{
    gsub (/__PACKAGE_NAME__/, "libguestfs");
    gsub (/__PACKAGE_VERSION__/, "1.36.13");
    gsub (/__PACKAGE_VERSION_FULL__/, "1.36.13");
    gsub (/<!--__DEPENDENCIES__-->/, dependencies);
    gsub (/__BRANDING__/, branding);
    gsub (/__RELEASE_PKG__/, release_pkg);
    gsub (/__BASE_PATTERN__/, base_pattern);
    gsub (/__KIWI_BOOT__/, kiwi_boot);
    gsub (/<!--__REPOS__-->/, repos);
    print;
  }' \
  $datadir/kiwi-config.xml.in > $output/config.xml

echo "kiwi config folder written to $output"