Skip to content

Commit 2774d16

Browse files
committed
switch to lowercase variable names for most vars
It was getting a bit inconsistent. This also helps with diffing this script and cmd-osbuild from COSA.
1 parent 0eb9876 commit 2774d16

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

custom-coreos-disk-images.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,24 @@ main() {
6262
case "$1" in
6363
--imgref)
6464
shift # The arg is next in position args
65-
IMGREF=$1
65+
imgref=$1
6666
;;
6767
--ociarchive)
68-
shift; # The arg is next in position args
69-
OCIARCHIVE=$1
68+
shift # The arg is next in position args
69+
ociarchive=$1
7070
;;
7171
--osname)
7272
shift # The arg is next in position args
73-
OSNAME=$1
74-
if [ $OSNAME !~ rhcos|fedora-coreos ]; then
73+
osname=$1
74+
if [ $osname !~ rhcos|fedora-coreos ]; then
7575
echo "--osname must be rhcos or fedora-coreos" >&2
7676
exit 1
7777
fi
7878
;;
7979
--platforms)
8080
shift # The arg is next in position args
8181
# Split the comma separated string of platforms into an array
82-
IFS=, read -ra PLATFORMS <<<"$1"
82+
IFS=, read -ra platforms <<<"$1"
8383
;;
8484
--)
8585
shift
@@ -102,19 +102,19 @@ main() {
102102
exit 1
103103
fi
104104
# Make sure the given file exists
105-
if [ ! -f $OCIARCHIVE ]; then
105+
if [ ! -f $ociarchive ]; then
106106
echo "need to pass in the path to .ociarchive file"
107107
exit 1
108108
fi
109109
# Convert it to an absolute path
110-
OCIARCHIVE=$(readlink -f $OCIARCHIVE)
110+
ociarchive=$(readlink -f $ociarchive)
111111

112112
# Let's set the imgref. If no --imgref was provided then for cosmetic
113113
# purposes let's set a sane looking one.
114-
imgref="${IMGREF:-ostree-image-signed:oci-archive:/$(basename "${OCIARCHIVE}")}"
114+
imgref="${imgref:-ostree-image-signed:oci-archive:/$(basename "${ociarchive}")}"
115115

116116
# Let's default to `rhcos` for the OS Name for backwards compat
117-
osname="${OSNAME:-rhcos}"
117+
osname="${osname:-rhcos}"
118118

119119
# FCOS/RHCOS have different default disk image sizes
120120
# In the future should pull this from the container image
@@ -150,10 +150,10 @@ main() {
150150
runvm_osbuild_config_json="${tmpdir}/runvm-osbuild-config.json"
151151
cat > "${runvm_osbuild_config_json}" << EOF
152152
{
153-
"artifact-name-prefix": "$(basename -s .ociarchive $OCIARCHIVE)",
153+
"artifact-name-prefix": "$(basename -s .ociarchive $ociarchive)",
154154
"osname": "${osname}",
155155
"deploy-via-container": "true",
156-
"ostree-container": "${OCIARCHIVE}",
156+
"ostree-container": "${ociarchive}",
157157
"container-imgref": "${imgref}",
158158
"metal-image-size": "3072",
159159
"cloud-image-size": "${image_size}",
@@ -165,13 +165,13 @@ EOF
165165
--config "${runvm_osbuild_config_json}" \
166166
--mpp "${tmpdir}/coreos.osbuild.${ARCH}.mpp.yaml" \
167167
--outdir "${outdir}" \
168-
--platforms "$(IFS=,; echo "${PLATFORMS[*]}")"
168+
--platforms "$(IFS=,; echo "${platforms[*]}")"
169169

170-
for platform in "${PLATFORMS[@]}"; do
170+
for platform in "${platforms[@]}"; do
171171
# Set the filename of the artifact and the local image path
172172
# where from the OSBuild out directory where it resides.
173173
suffix="${SUPPORTED_PLATFORMS[$platform]}"
174-
imgname=$(basename -s .ociarchive $OCIARCHIVE)-${platform}.${ARCH}.${suffix}
174+
imgname=$(basename -s .ociarchive $ociarchive)-${platform}.${ARCH}.${suffix}
175175
imgpath="${outdir}/${platform}/${imgname}"
176176
mv "${imgpath}" ./
177177
echo "Created $platform image file at: ${imgname}"

0 commit comments

Comments
 (0)