@@ -14,13 +14,13 @@ function oraclelinux_print_help() {
14
14
$( basename " ${BASH_SOURCE[0]} " ) : Update the Oracle Linux image location in the specified templates
15
15
16
16
Usage:
17
- $( basename " ${BASH_SOURCE[0]} " ) [--version < version>] <template.yaml>...
17
+ $( basename " ${BASH_SOURCE[0]} " ) [--version-major <major version>] <template.yaml>...
18
18
19
19
Description:
20
20
This script updates the Oracle Linux image location in the specified templates.
21
21
Image location basename format:
22
22
23
- OL<version>U<release >_<arch>-kvm[-cloud]-b<build number>.qcow2
23
+ OL<major version>U<minor version >_<arch>-kvm[-cloud]-b<build number>.qcow2
24
24
25
25
Published Oracle Linux image information is fetched from the following URLs:
26
26
@@ -38,23 +38,23 @@ Examples:
38
38
Update the Oracle Linux image location in templates/**.yaml:
39
39
$ $( basename " ${BASH_SOURCE[0]} " ) templates/**.yaml
40
40
41
- Update the Oracle Linux image location to version 9 in ~/.lima/oraclelinux/lima.yaml:
42
- $ $( basename " ${BASH_SOURCE[0]} " ) --version 9 ~/.lima/oraclelinux/lima.yaml
41
+ Update the Oracle Linux image location to major version 9 in ~/.lima/oraclelinux/lima.yaml:
42
+ $ $( basename " ${BASH_SOURCE[0]} " ) --version-major 9 ~/.lima/oraclelinux/lima.yaml
43
43
$ limactl factory-reset oraclelinux
44
44
45
45
Flags:
46
- --version < version> Use the specified Oracle Linux <version>.
47
- The version must be 7+ for x86_64 or 8+ for aarch64.
48
- -h, --help Print this help message
46
+ --version-major <major version> Use the specified Oracle Linux <major version>.
47
+ The major version must be 7+ for x86_64 or 8+ for aarch64.
48
+ -h, --help Print this help message
49
49
HELP
50
50
}
51
51
52
52
# print the URL spec for the given location
53
53
function oraclelinux_url_spec_from_location() {
54
54
local location=$1 jq_filter url_spec
55
55
jq_filter=' capture("
56
- ^https://yum\\.oracle\\.com/templates/OracleLinux/OL(?<path_version >\\d+)/u(?<path_release >\\d+)/(?<path_arch>[^/]+)/
57
- OL(?<version >\\d+)U(?<release >\\d+)_(?<arch>[^-]+)-(?<type>[^-]+)(?<cloud>-cloud)?-b(?<build_number>\\d+)\\.(?<file_extension>.*)$
56
+ ^https://yum\\.oracle\\.com/templates/OracleLinux/OL(?<path_major_version >\\d+)/u(?<path_minor_version >\\d+)/(?<path_arch>[^/]+)/
57
+ OL(?<major_version >\\d+)U(?<minor_version >\\d+)_(?<arch>[^-]+)-(?<type>[^-]+)(?<cloud>-cloud)?-b(?<build_number>\\d+)\\.(?<file_extension>.*)$
58
58
";"x")
59
59
'
60
60
url_spec=$( jq -e -r " ${jq_filter} " <<< " \" ${location} \" " )
@@ -63,7 +63,7 @@ function oraclelinux_url_spec_from_location() {
63
63
64
64
readonly oraclelinux_jq_filter_json_url='
65
65
" https://yum.oracle.com/templates/OracleLinux/" +
66
- " ol\( .path_version ) \( if .path_arch ! = " x86_64" then " _" + .path_arch else " " end)\( .cloud // " " )-template.json"
66
+ " ol\( .path_major_version ) \( if .path_arch ! = " x86_64" then " _" + .path_arch else " " end)\( .cloud // " " )-template.json"
67
67
'
68
68
69
69
function oraclelinux_json_url_from_url_spec() {
@@ -95,7 +95,7 @@ function oraclelinux_latest_image_entry_for_url_spec() {
95
95
function oraclelinux_cache_key_for_image_kernel() {
96
96
local location=$1 overriding=${3:- " {}" } url_spec
97
97
url_spec=$( oraclelinux_url_spec_from_location " ${location} " | jq -r " . + ${overriding} " )
98
- jq -r '[" oraclelinux" , .path_version , .type, .cloud // empty, .arch, .file_extension] | join(" :" )' <<<" ${url_spec} "
98
+ jq -r '[" oraclelinux" , .path_major_version , .type, .cloud // empty, .arch, .file_extension] | join(" :" )' <<<" ${url_spec} "
99
99
}
100
100
101
101
function oraclelinux_image_entry_for_image_kernel() {
@@ -141,27 +141,27 @@ while [[ $# -gt 0 ]]; do
141
141
exit 0
142
142
;;
143
143
-d | --debug) set -x ;;
144
- --version)
144
+ --version-major )
145
145
if [[ -n $2 && $2 != -* ]]; then
146
146
overriding=$(
147
- path_version =" ${2} "
148
- [[ ${path_version } =~ ^[0-9]+$ ]] || error_exit " Oracle Linux version must be a number"
149
- [[ ${path_version } -eq 7 ]] && echo ' Oracle Linux version 7 exists only for x86_64. It may fail for aarch64.' >&2
150
- [[ ${path_version } -gt 7 ]] || error_exit " Oracle Linux version must be 7+ for x86_64 or 8+ for aarch64"
151
- json_vars path_version <<< " ${overriding}"
147
+ path_major_version =" ${2} "
148
+ [[ ${path_major_version } =~ ^[0-9]+$ ]] || error_exit " Oracle Linux major version must be a number"
149
+ [[ ${path_major_version } -eq 7 ]] && echo ' Oracle Linux major version 7 exists only for x86_64. It may fail for aarch64.' >&2
150
+ [[ ${path_major_version } -gt 7 ]] || error_exit " Oracle Linux major version must be 7+ for x86_64 or 8+ for aarch64"
151
+ json_vars path_major_version <<< " ${overriding}"
152
152
)
153
153
shift
154
154
else
155
- error_exit " --version requires a value"
155
+ error_exit " --version-major requires a value"
156
156
fi
157
157
;;
158
- --version=*)
158
+ --version-major =*)
159
159
overriding=$(
160
- path_version =" ${1#* =} "
161
- [[ ${path_version } =~ ^[0-9]+$ ]] || error_exit " Oracle Linux version must be a number"
162
- [[ ${path_version } -eq 7 ]] && echo ' Oracle Linux version 7 exists only for x86_64. It may fail for aarch64.' >&2
163
- [[ ${path_version } -gt 7 ]] || error_exit " Oracle Linux version must be 7+ for x86_64 or 8+ for aarch64"
164
- json_vars path_version <<< " ${overriding}"
160
+ path_major_version =" ${1#* =} "
161
+ [[ ${path_major_version } =~ ^[0-9]+$ ]] || error_exit " Oracle Linux major version must be a number"
162
+ [[ ${path_major_version } -eq 7 ]] && echo ' Oracle Linux major version 7 exists only for x86_64. It may fail for aarch64.' >&2
163
+ [[ ${path_major_version } -gt 7 ]] || error_exit " Oracle Linux major version must be 7+ for x86_64 or 8+ for aarch64"
164
+ json_vars path_major_version <<< " ${overriding}"
165
165
)
166
166
;;
167
167
*.yaml) templates+=(" $1 " ) ;;
0 commit comments