Skip to content

Commit 8605307

Browse files
committed
feat(olss): ✨ add utm cloud
Signed-off-by: Philippe Vanhaesendonck <philippe.vanhaesendonck@oracle.com>
1 parent 9375afb commit 8605307

File tree

5 files changed

+185
-2
lines changed

5 files changed

+185
-2
lines changed

oracle-linux-image-tools/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ The tool currently supports:
1212
- Distributions:
1313
- Oracle Linux 7 update 9 -- Slim (x86_64)
1414
- Oracle Linux 8 update 6 -- Slim (x86_64 and aarch64)
15-
__Note__: for aarch64, only Generic and OCI clouds are supported
15+
__Note__: for aarch64, only Generic, OCI and UTM clouds are supported
1616
- Oracle Linux 9 update 0 -- Slim (x86_64 and aarch64)
17-
__Note__: for aarch64, only Generic and OCI clouds are supported
17+
__Note__: for aarch64, only Generic, OCI and UTM clouds are supported
1818
- Clouds:
1919
- Microsoft Azure cloud
2020
Target packages: WALinuxAgent
@@ -35,6 +35,10 @@ The tool currently supports:
3535
- Vagrant (libvirt provider)
3636
Target packages: nfs-utils
3737
Image format: box
38+
- UTM ([UTM for macOS](https://mac.getutm.app/))
39+
Target packages: none
40+
Image format: utm
41+
__Note__: only for aarch64 distributions
3842
- Generic (No cloud setup)
3943
Target packages: none
4044
Image format: VirtualBox OVA or QCOW2 (depending on the builder used)
54.7 KB
Loading
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>ConfigurationVersion</key>
6+
<integer>2</integer>
7+
<key>Debug</key>
8+
<dict>
9+
<key>DebugLog</key>
10+
<false/>
11+
</dict>
12+
<key>Display</key>
13+
<dict>
14+
<key>ConsoleFont</key>
15+
<string>Menlo</string>
16+
<key>ConsoleFontSize</key>
17+
<integer>12</integer>
18+
<key>ConsoleOnly</key>
19+
<true/>
20+
<key>ConsoleTheme</key>
21+
<string>Default</string>
22+
<key>DisplayDownscaler</key>
23+
<string>linear</string>
24+
<key>DisplayFitScreen</key>
25+
<true/>
26+
<key>DisplayUpscaler</key>
27+
<string>linear</string>
28+
</dict>
29+
<key>Drives</key>
30+
<array>
31+
<dict>
32+
<key>ImagePath</key>
33+
<string>image.qcow2</string>
34+
<key>ImageType</key>
35+
<string>disk</string>
36+
<key>InterfaceType</key>
37+
<string>virtio</string>
38+
</dict>
39+
<dict>
40+
<key>ImageType</key>
41+
<string>cd</string>
42+
<key>InterfaceType</key>
43+
<string>usb</string>
44+
<key>Removable</key>
45+
<true/>
46+
</dict>
47+
</array>
48+
<key>Info</key>
49+
<dict>
50+
<key>Icon</key>
51+
<string>Penguin.png</string>
52+
<key>IconCustom</key>
53+
<true/>
54+
<key>Notes</key>
55+
<string>Default user/initial password: opc/opc
56+
Root password: locked</string>
57+
</dict>
58+
<key>Input</key>
59+
<dict>
60+
<key>InputLegacy</key>
61+
<false/>
62+
</dict>
63+
<key>Networking</key>
64+
<dict>
65+
<key>NetworkCard</key>
66+
<string>virtio-net-device</string>
67+
<key>NetworkEnabled</key>
68+
<true/>
69+
</dict>
70+
<key>Printing</key>
71+
<dict/>
72+
<key>Sharing</key>
73+
<dict>
74+
<key>ClipboardSharing</key>
75+
<true/>
76+
<key>DirectoryName</key>
77+
<string></string>
78+
<key>DirectorySharing</key>
79+
<false/>
80+
</dict>
81+
<key>Sound</key>
82+
<dict>
83+
<key>SoundCard</key>
84+
<string>hda</string>
85+
<key>SoundEnabled</key>
86+
<true/>
87+
</dict>
88+
<key>System</key>
89+
<dict>
90+
<key>Architecture</key>
91+
<string>aarch64</string>
92+
<key>BootDevice</key>
93+
<string>hdd</string>
94+
<key>CPUCount</key>
95+
<integer>0</integer>
96+
<key>ForceMulticore</key>
97+
<false/>
98+
<key>JITCacheSize</key>
99+
<integer>0</integer>
100+
<key>MachineProperties</key>
101+
<string>highmem=off</string>
102+
<key>Memory</key>
103+
<integer>2048</integer>
104+
<key>SystemUUID</key>
105+
<string>00000000-0000-0000-0000-000000000000</string>
106+
<key>Target</key>
107+
<string>virt</string>
108+
</dict>
109+
</dict>
110+
</plist>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Cleanup and package image for the "None" image
4+
#
5+
# Copyright (c) 2022 Oracle and/or its affiliates.
6+
# Licensed under the Universal Permissive License v 1.0 as shown at
7+
# https://oss.oracle.com/licenses/upl
8+
#
9+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
10+
#
11+
12+
#######################################
13+
# Image packaging:
14+
# For VistualBox we convert back to VMDK and re-create the OVA file
15+
# For qemu we convert to a qcow2 file
16+
# Globals:
17+
# CLOUD_DIR CLOUD
18+
# VM_NAME
19+
# Arguments:
20+
# None
21+
# Returns:
22+
# None
23+
#######################################
24+
cloud::image_package() {
25+
local utm_dir uuid
26+
utm_dir="${VM_NAME}.utm"
27+
mkdir -p "${utm_dir}/Images"
28+
common::convert_to_qcow2 "${utm_dir}/Images/${VM_NAME}.qcow2"
29+
cp "${CLOUD_DIR}/${CLOUD}/Penguin.png" "${utm_dir}"
30+
uuid=$(python3 -c "import uuid; print(str(uuid.uuid4()).upper())")
31+
sed \
32+
-e "s/image.qcow2/${VM_NAME}.qcow2/" \
33+
-e "s!opc/opc!opc/${SSH_PASSWORD}!" \
34+
-e "s/00000000-0000-0000-0000-000000000000/${uuid}/" \
35+
"${CLOUD_DIR}/${CLOUD}/config.plist" > "${utm_dir}/config.plist"
36+
zip -r "${utm_dir}.zip" "${utm_dir}"
37+
rm -rf "${utm_dir}"
38+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Packer provisioning script for UTM
4+
#
5+
# Copyright (c) 2022 Oracle and/or its affiliates.
6+
# Licensed under the Universal Permissive License v 1.0 as shown at
7+
# https://oss.oracle.com/licenses/upl
8+
#
9+
# Description: UTM specific provisioning.n
10+
#
11+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
12+
#
13+
14+
#######################################
15+
# Provisioning module
16+
# Globals:
17+
# None
18+
# Arguments:
19+
# None
20+
# Returns:
21+
# None
22+
#######################################
23+
cloud::provision()
24+
{
25+
hash=$(/usr/libexec/platform-python -c "import crypt; print(crypt.crypt('${SSH_PASSWORD}', crypt.METHOD_SHA512))")
26+
useradd opc -c "Oracle Public Cloud User" -G wheel -m -p "${hash}"
27+
passwd -e opc
28+
echo "%opc ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/opc
29+
chmod 0440 /etc/sudoers.d/opc
30+
restorecon /etc/sudoers.d/opc
31+
}

0 commit comments

Comments
 (0)