Update build script to create compatible VIB for ESXi 8.x

This commit is contained in:
William Lam 2023-04-21 14:55:22 -07:00
parent 2358346771
commit 5d92c2a4d4
4 changed files with 161 additions and 40 deletions

View File

@ -10,40 +10,137 @@ Here is an example of running the script:
./build.sh
Untagged: ghettovcb:latest
Deleted: sha256:af50b3cc12eec9277e04921e556fe6a62c64d9e503d850d7de59a9cf47b401bb
Deleted: sha256:bbf8b88d685825840508451014e38f84e459ffb75e7b2a4e185e7f5c47c7b618
Deleted: sha256:a72afa7385618d5865b88300b1889385b9e6204547bd88c6f719fb15a81217e3
Deleted: sha256:d221fb0ba5af54c0de4d15e2eec3fdafcee97fd895aab6c359372fd76f84b339
Sending build context to Docker daemon 6.656kB
Deleted: sha256:4961ac02e829aa3d71401565027e395f254b4a220570333b9deebd588d5bd8b0
Deleted: sha256:b2203f902261eee689c7cd066fed48687fe1dcbf72bf5c337f3e878b759b221a
Deleted: sha256:5cd0340cce143df29664f5b095bafbe993e57b4fb7f7cb41c9f43b1fe36fd6fc
Deleted: sha256:cd201ab3ba5c8a3bd20ed924fb67600c164d0950416630107303da6090c16c5c
Deleted: sha256:085f155aaa2fcccc938ab899675ed05f6712f33a212f5015e7029e255ff85d53
Deleted: sha256:3f435a105eaf07a4f931b9e5438b4f753d12e4dbeb99aa30726f662c03a5ad3a
Deleted: sha256:47227020e006eea1af0f5061ee277402bbd96a49ccb3f5c9e7c5fd5e1f456cf8
Sending build context to Docker daemon 9.728kB
Step 1/8 : FROM lamw/vibauthor
---> a673ffe4ba43
Step 2/8 : RUN rpm --rebuilddb
---> Using cache
---> 753af48ef9af
---> Running in 894b1e52ce30
Removing intermediate container 894b1e52ce30
---> e105a98f75ef
Step 3/8 : RUN yum clean all
---> Using cache
---> 689b05a480e2
---> Running in 5418e2b59881
Loaded plugins: fastestmirror, ovl
Cleaning repos: base extras updates
Cleaning up Everything
Removing intermediate container 5418e2b59881
---> 1710944fd26b
Step 4/8 : RUN yum update -y nss curl libcurl;yum clean all
---> Using cache
---> c51671aed6fa
---> Running in ab7ac3f661c4
Loaded plugins: fastestmirror, ovl
Setting up Update Process
Determining fastest mirrors
Resolving Dependencies
--> Running transaction check
---> Package curl.x86_64 0:7.19.7-53.el6_9 will be updated
---> Package curl.x86_64 0:7.19.7-54.el6_10 will be an update
---> Package libcurl.x86_64 0:7.19.7-53.el6_9 will be updated
---> Package libcurl.x86_64 0:7.19.7-54.el6_10 will be an update
---> Package nss.x86_64 0:3.36.0-8.el6 will be updated
--> Processing Dependency: nss = 3.36.0-8.el6 for package: nss-sysinit-3.36.0-8.el6.x86_64
--> Processing Dependency: nss(x86-64) = 3.36.0-8.el6 for package: nss-tools-3.36.0-8.el6.x86_64
---> Package nss.x86_64 0:3.44.0-7.el6_10 will be an update
--> Processing Dependency: nss-softokn(x86-64) >= 3.44.0-1 for package: nss-3.44.0-7.el6_10.x86_64
--> Running transaction check
---> Package nss-softokn.x86_64 0:3.14.3-23.3.el6_8 will be updated
---> Package nss-softokn.x86_64 0:3.44.0-6.el6_10 will be an update
---> Package nss-sysinit.x86_64 0:3.36.0-8.el6 will be updated
---> Package nss-sysinit.x86_64 0:3.44.0-7.el6_10 will be an update
---> Package nss-tools.x86_64 0:3.36.0-8.el6 will be updated
---> Package nss-tools.x86_64 0:3.44.0-7.el6_10 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Updating:
curl x86_64 7.19.7-54.el6_10 updates 198 k
libcurl x86_64 7.19.7-54.el6_10 updates 170 k
nss x86_64 3.44.0-7.el6_10 updates 883 k
Updating for dependencies:
nss-softokn x86_64 3.44.0-6.el6_10 updates 288 k
nss-sysinit x86_64 3.44.0-7.el6_10 updates 54 k
nss-tools x86_64 3.44.0-7.el6_10 updates 472 k
Transaction Summary
================================================================================
Upgrade 6 Package(s)
Total download size: 2.0 M
Downloading Packages:
--------------------------------------------------------------------------------
Total 12 MB/s | 2.0 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Updating : nss-softokn-3.44.0-6.el6_10.x86_64 1/12
Updating : nss-sysinit-3.44.0-7.el6_10.x86_64 2/12
Updating : nss-3.44.0-7.el6_10.x86_64 3/12
Updating : libcurl-7.19.7-54.el6_10.x86_64 4/12
Updating : curl-7.19.7-54.el6_10.x86_64 5/12
Updating : nss-tools-3.44.0-7.el6_10.x86_64 6/12
Cleanup : nss-tools-3.36.0-8.el6.x86_64 7/12
Cleanup : curl-7.19.7-53.el6_9.x86_64 8/12
Cleanup : libcurl-7.19.7-53.el6_9.x86_64 9/12
Cleanup : nss-sysinit-3.36.0-8.el6.x86_64 10/12
Cleanup : nss-3.36.0-8.el6.x86_64 11/12
Cleanup : nss-softokn-3.14.3-23.3.el6_8.x86_64 12/12
Verifying : curl-7.19.7-54.el6_10.x86_64 1/12
Verifying : libcurl-7.19.7-54.el6_10.x86_64 2/12
Verifying : nss-softokn-3.44.0-6.el6_10.x86_64 3/12
Verifying : nss-tools-3.44.0-7.el6_10.x86_64 4/12
Verifying : nss-sysinit-3.44.0-7.el6_10.x86_64 5/12
Verifying : nss-3.44.0-7.el6_10.x86_64 6/12
Verifying : nss-softokn-3.14.3-23.3.el6_8.x86_64 7/12
Verifying : nss-3.36.0-8.el6.x86_64 8/12
Verifying : nss-sysinit-3.36.0-8.el6.x86_64 9/12
Verifying : libcurl-7.19.7-53.el6_9.x86_64 10/12
Verifying : curl-7.19.7-53.el6_9.x86_64 11/12
Verifying : nss-tools-3.36.0-8.el6.x86_64 12/12
Updated:
curl.x86_64 0:7.19.7-54.el6_10 libcurl.x86_64 0:7.19.7-54.el6_10
nss.x86_64 0:3.44.0-7.el6_10
Dependency Updated:
nss-softokn.x86_64 0:3.44.0-6.el6_10 nss-sysinit.x86_64 0:3.44.0-7.el6_10
nss-tools.x86_64 0:3.44.0-7.el6_10
Complete!
Loaded plugins: fastestmirror, ovl
Cleaning repos: base extras updates
Cleaning up Everything
Cleaning up list of fastest mirrors
Removing intermediate container ab7ac3f661c4
---> 5690d9c8f3b0
Step 5/8 : COPY create_ghettoVCB_vib.sh create_ghettoVCB_vib.sh
---> 7d2e7dffd928
---> 41528c8b4a87
Step 6/8 : RUN chmod +x create_ghettoVCB_vib.sh
---> Running in feaffc690f72
Removing intermediate container feaffc690f72
---> 25dbc3dee22a
---> Running in 1ae6b4f7a749
Removing intermediate container 1ae6b4f7a749
---> c10f6341e862
Step 7/8 : RUN /root/create_ghettoVCB_vib.sh
---> Running in 9eae129c4da1
---> Running in bd605bcc5442
Initialized empty Git repository in /root/ghettoVCB/.git/
Successfully created vghetto-ghettoVCB.vib.
Successfully created vghetto-ghettoVCB-offline-bundle.zip.
Removing intermediate container 9eae129c4da1
---> ddb549b11636
Removing intermediate container bd605bcc5442
---> 7d64d39dea4d
Step 8/8 : CMD ["/bin/bash"]
---> Running in dda3680d7a69
Removing intermediate container dda3680d7a69
---> 616ef9508225
Successfully built 616ef9508225
---> Running in 043692b22cde
Removing intermediate container 043692b22cde
---> 7e1196135f15
Successfully built 7e1196135f15
Successfully tagged ghettovcb:latest
```

View File

@ -6,6 +6,8 @@
GVCB_REPO=https://github.com/lamw/ghettoVCB.git
GVCB_REPO_DIR=ghettoVCB
GVCB_TEMP_DIR=/tmp/ghettoVCB-$$
GVCB_VIB_NAME=vghetto-ghettoVCB.vib
GCVB_OFFLINE_BUNDLE_NAME=vghetto-ghettoVCB-offline-bundle.zip
# Ensure git is installed
git version > /dev/null 2>&1
@ -42,6 +44,30 @@ mkdir -p ${GVCB_TEMP_DIR}
# Create VIB spec payload directory
mkdir -p ${VIB_PAYLOAD_DIR}
# Create ghettoVCB bin/conf directories
GVCB_BIN_DIR=${VIB_PAYLOAD_DIR}/opt/ghettovcb/bin
GVCB_CONF_DIR=${VIB_PAYLOAD_DIR}/opt/ghettovcb
mkdir -p ${GVCB_BIN_DIR}
mkdir -p ${GVCB_CONF_DIR}
# Copy ghettoVCB files to bin/conf directories
cp ${GVCB_REPO_DIR}/*.sh ${GVCB_BIN_DIR}
cp ${GVCB_REPO_DIR}/*.conf ${GVCB_CONF_DIR}
cp ${GVCB_REPO_DIR}/*_template ${GVCB_CONF_DIR}
# Ensure config files are writable
chmod -R +tw ${GVCB_CONF_DIR}
# Create tgz with payload
tar czf ${GVCB_TEMP_DIR}/payload1 -C ${VIB_PAYLOAD_DIR} opt
# Calculate payload size/hash
PAYLOAD_FILES=$(tar tf ${GVCB_TEMP_DIR}/payload1 | grep -v -E '/$' | sed -e 's/^/ <file>/' -e 's/$/<\/file>/')
PAYLOAD_SIZE=$(stat -c %s ${GVCB_TEMP_DIR}/payload1)
PAYLOAD_SHA256=$(sha256sum ${GVCB_TEMP_DIR}/payload1 | awk '{print $1}')
PAYLOAD_SHA256_ZCAT=$(zcat ${GVCB_TEMP_DIR}/payload1 | sha256sum | awk '{print $1}')
PAYLOAD_SHA1_ZCAT=$(zcat ${GVCB_TEMP_DIR}/payload1 | sha1sum | awk '{print $1}')
# Create ghettoVCB VIB descriptor.xml
cat > ${VIB_DESC_FILE} << __GHETTOVCB__
<vib version="5.0">
@ -69,6 +95,7 @@ cat > ${VIB_DESC_FILE} << __GHETTOVCB__
<maintenance-mode>false</maintenance-mode>
</system-requires>
<file-list>
${PAYLOAD_FILES}
</file-list>
<acceptance-level>community</acceptance-level>
<live-install-allowed>true</live-install-allowed>
@ -77,27 +104,24 @@ cat > ${VIB_DESC_FILE} << __GHETTOVCB__
<stateless-ready>true</stateless-ready>
<overlay>false</overlay>
<payloads>
<payload name="payload1" type="vgz"></payload>
<payload name="payload1" type="tgz" size="${PAYLOAD_SIZE}">
<checksum checksum-type="sha-256">${PAYLOAD_SHA256}</checksum>
<checksum checksum-type="sha-256" verify-process="gunzip">${PAYLOAD_SHA256_ZCAT}</checksum>
<checksum checksum-type="sha-1" verify-process="gunzip">${PAYLOAD_SHA1_ZCAT}</checksum>
</payload>
</payloads>
</vib>
__GHETTOVCB__
# Create ghettoVCB bin/conf directories
GVCB_BIN_DIR=${VIB_PAYLOAD_DIR}/opt/ghettovcb/bin
GVCB_CONF_DIR=${VIB_PAYLOAD_DIR}/opt/ghettovcb
mkdir -p ${GVCB_BIN_DIR}
mkdir -p ${GVCB_CONF_DIR}
# Create VIB using ar
touch ${GVCB_TEMP_DIR}/sig.pkcs7
ar r ${GVCB_VIB_NAME} ${GVCB_TEMP_DIR}/descriptor.xml ${GVCB_TEMP_DIR}/sig.pkcs7 ${GVCB_TEMP_DIR}/payload1
# Copy ghettoVCB files to bin/conf directories
cp ${GVCB_REPO_DIR}/*.sh ${GVCB_BIN_DIR}
cp ${GVCB_REPO_DIR}/*.conf ${GVCB_CONF_DIR}
cp ${GVCB_REPO_DIR}/*_template ${GVCB_CONF_DIR}
# Create offline bundle
PYTHONPATH=/opt/vmware/vibtools-6.0.0-847598/bin python -c "import vibauthorImpl; vibauthorImpl.CreateOfflineBundle(\"${GVCB_VIB_NAME}\", \"${GCVB_OFFLINE_BUNDLE_NAME}\", True)"
# Ensure config files are writable
chmod -R +tw ${GVCB_CONF_DIR}
# Create ghettoVCB VIB + offline bundle
vibauthor -C -t ${GVCB_TEMP_DIR} -v vghetto-ghettoVCB.vib -O vghetto-ghettoVCB-offline-bundle.zip -f
# Show details of VIB that was just created
vibauthor -i -v ${GVCB_VIB_NAME}
# Remove ghettoVCB temp dir
rm -rf ${GVCB_TEMP_DIR}
rm -rf ${GVCB_TEMP_DIR}

View File

@ -6,7 +6,7 @@
###### DO NOT EDIT PASS THIS LINE ######
LAST_MODIFIED_DATE=2021_10_20
LAST_MODIFIED_DATE=2023_04_21
VERSION=1
VERSION_STRING=${LAST_MODIFIED_DATE}_${VERSION}

View File

@ -9,7 +9,7 @@
# User Definable Parameters
##################################################################
LAST_MODIFIED_DATE=2021_10_20
LAST_MODIFIED_DATE=2023_04_21
VERSION=1
# directory that all VM backups should go (e.g. /vmfs/volumes/SAN_LUN1/mybackupdir)