-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path1_ocp4_vsphere_upi_download_3_rhcos.sh
executable file
·37 lines (32 loc) · 2.01 KB
/
1_ocp4_vsphere_upi_download_3_rhcos.sh
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
#!/usr/bin/env bash
source 0_ocp4_vsphere_upi_init_vars
echo "Downloading RHCOS release $BUILDNUMBER..."
# Download RHCOS ova image
for i in $(curl -s --list-only https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/${RHCOS}/latest/ | egrep "rhcos-${RHCOS}(.*)-vmware" | grep href | sed 's/.*href="//' | sed 's/".*//' | grep '^[a-zA-Z].*'); do
curl -s -O https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/${RHCOS}/latest/$i
govc vm.destroy /${GOVC_DATACENTER}/vm/${RHCOS_TEMPLATE}
govc import.ova -name=${RHCOS_TEMPLATE} $i
done
rm -f rhcos-${RHCOS}*
# Download RHCOS bare-metal image
for i in $(curl -s --list-only https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/${RHCOS}/latest/ | egrep "rhcos-${RHCOS}(.*)-${INSTPREFIX}|rhcos-${RHCOS}(.*)-metal" | grep href | sed 's/.*href="//' | sed 's/".*//' | grep '^[a-zA-Z].*'); do
curl -s -O https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/${RHCOS}/latest/$i
done
if [ ! -d /var/www/html ]; then
echo "WARNING: /var/www/html does not exist! Please make sure to install httpd service on this system. The rhcos installer files will need to be copied to /var/www/html directory manually once HTTPD is installed." >&2
exit 1
else
rm -f /var/www/html/rhcos-${RHCOS}*
cp rhcos-${RHCOS}* /var/www/html
chmod 644 /var/www/html/rhcos-${RHCOS}*
rm -f rhcos-${RHCOS}*
if [ ! -d /var/lib/tftpboot ]; then
echo "WARNING: /var/lib/tftpboot does not exist! Please make sure to install tftp-server on this system. The rhcos installer kernel and image files will need to be copied to /var/lib/tftpboot directory manually once tftp-server is installed." >&2
exit 1
else
mkdir -p /var/lib/tftpboot/rhcos
rm -f /var/lib/tftpboot/rhcos/rhcos-${RHCOS}*
cp /var/www/html/rhcos-${RHCOS}*-${INSTPREFIX}-initramfs*.img /var/www/html/rhcos-${RHCOS}*-${INSTPREFIX}-kernel* /var/lib/tftpboot/rhcos
rm -f /var/www/html/rhcos-${RHCOS}*-${INSTPREFIX}-initramfs*.img /var/www/html/rhcos-${RHCOS}*-${INSTPREFIX}-kernel*
fi
fi