-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathp2v.ks.in
192 lines (140 loc) · 4.4 KB
/
p2v.ks.in
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
# Kickstart file for creating the virt-p2v ISO.
# (C) Copyright 2014-2019 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, see <https://www.gnu.org/licenses/>.
# Generated by virt-p2v-make-kickstart __PACKAGE_VERSION_FULL__
lang en_US.UTF-8
keyboard us
timezone --utc GMT
rootpw --plaintext p2v
selinux --enforcing
firewall --enabled
# Make sure that systemd doesn't rename the network device. We have
# to tell Anaconda we're using eth0, *and* we have to pass
# net.ifnames=0 on the kernel command line.
network --bootproto=dhcp --device=eth0
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH net.ifnames=0"
zerombr
clearpart --all --initlabel
part / --size 3000 --fstype ext4
reboot
# Repository lines:
__REPOS__
# Packages to install in the ISO. For dependencies, see
# p2v/Makefile.am. Note that libguestfs is NOT required by virt-p2v.
%packages __PACKAGES_OPTIONS__
@core
# rpm must be installed, else you'll hit RHBZ#1089566.
rpm
# Note you must have a kernel, else the boot menu won't work:
kernel
# This is required in order for RHEL to set the root password.
passwd
# RHEL needs this in order to get networking.
NetworkManager
# Required to run firewall --enabled kickstart command:
firewalld
# Needed by post script to unpack the blobs.
/usr/bin/base64
/usr/bin/gzip
# Work around https://bugzilla.redhat.com/show_bug.cgi?id=1182362
tar
# https://bugzilla.redhat.com/show_bug.cgi?id=1168223
dracut-live
# The dependencies of virt-p2v.
__DEPENDENCIES__
# Extra packages requested by the user via the virt-p2v-make-kickstart
# --install option (if any).
__EXTRA_PACKAGES__
%end
# Post-install configuration.
%post
# Base64-decoding of SSH Identity.
base64 -d -i > /var/tmp/id_rsa << EOF
__BASE64_SSH_IDENTITY__
EOF
if test -s /var/tmp/id_rsa; then
chmod 0600 /var/tmp/id_rsa
else
rm /var/tmp/id_rsa
fi
# Base64-decoding of /etc/issue
base64 -d -i > /etc/issue << EOF
__BASE64_ISSUE__
EOF
cp /etc/issue /etc/issue.net
# Base64-decoding of launch-virt-p2v
base64 -d -i > /usr/bin/launch-virt-p2v <<EOF
__BASE64_LAUNCH_VIRT_P2V__
EOF
chmod 0755 /usr/bin/launch-virt-p2v
# Base64-decoding of p2v.service unit file
base64 -d -i > /etc/systemd/system/p2v.service <<EOF
__BASE64_P2V_SERVICE__
EOF
# Base64-decoding of virt-p2v binary
# md5(virt-p2v) = __MD5SUM_VIRT_P2V__
base64 -d -i <<EOF | gzip -cd > /usr/bin/virt-p2v
__BASE64_VIRT_P2V__
EOF
chmod 0755 /usr/bin/virt-p2v
# Update the default getty target to login automatically as root without
# prompting for a password
sed -i 's/^ExecStart=\(.*\)/ExecStart=\1 -a root/' \
/usr/lib/systemd/system/[email protected]
# Reserve tty1 as a getty so we can document it clearly
echo ReserveVT=1 >> /etc/systemd/logind.conf
# Force text mode
systemctl set-default multi-user.target
# Start p2v service
systemctl enable p2v.service
# Disable ssh service (RHBZ#1248678)
systemctl disable sshd.service
%end
%post --nochroot
PRODUCT='Virt P2V'
PRODUCT_SHORT='virt-p2v'
PACKAGE='__PACKAGE_NAME__'
VERSION='__PACKAGE_VERSION__'
echo "Customizing boot menu"
sed -i -e '
# Put product information at the top of the file
1 {
i '"say $PRODUCT $VERSION"'
i '"menu title $PRODUCT_SHORT $VERSION"'
}
# Remove any existing menu title
/^menu title .*/d
# Set the default timeout to 60 seconds
s/^timeout .*/timeout 600/
' $LIVE_ROOT/isolinux/isolinux.cfg
# store image version info in the ISO
cat > $LIVE_ROOT/isolinux/version <<EOF
PRODUCT='$PRODUCT'
PRODUCT_SHORT='${PRODUCT_SHORT}'
#PRODUCT_CODE=$PRODUCT_CODE
#RECIPE_SHA256=$RECIPE_SHA256
#RECIPE_RPM=$RECIPE_RPM
PACKAGE=$PACKAGE
VERSION=$VERSION
EOF
# overwrite user visible banners with the image versioning info
cat > $INSTALL_ROOT/etc/$PACKAGE-release <<EOF
$PRODUCT release $VERSION
EOF
# replace initramfs if regenerated
if [ -f "$INSTALL_ROOT/initrd0.img" ]; then
mv -v "$INSTALL_ROOT/initrd0.img" "$LIVE_ROOT/isolinux/initrd0.img"
fi
%end