Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions oracle-linux-image-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ The tool currently supports:
- Distributions:
- Oracle Linux 7 update 9 -- Slim (x86_64)
- Oracle Linux 8 update 6 -- Slim (x86_64 and aarch64)
__Note__: for aarch64, only Generic and OCI clouds are supported
__Note__: for aarch64, only Generic, OCI and UTM clouds are supported
- Oracle Linux 9 update 0 -- Slim (x86_64 and aarch64)
__Note__: for aarch64, only Generic and OCI clouds are supported
__Note__: for aarch64, only Generic, OCI and UTM clouds are supported
- Clouds:
- Microsoft Azure cloud
Target packages: WALinuxAgent
Expand All @@ -35,6 +35,10 @@ The tool currently supports:
- Vagrant (libvirt provider)
Target packages: nfs-utils
Image format: box
- UTM ([UTM for macOS](https://mac.getutm.app/))
Target packages: none
Image format: utm
__Note__: only for aarch64 distributions
- Generic (No cloud setup)
Target packages: none
Image format: VirtualBox OVA or QCOW2 (depending on the builder used)
Expand Down
Binary file added oracle-linux-image-tools/cloud/utm/Penguin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
110 changes: 110 additions & 0 deletions oracle-linux-image-tools/cloud/utm/config.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ConfigurationVersion</key>
<integer>2</integer>
<key>Debug</key>
<dict>
<key>DebugLog</key>
<false/>
</dict>
<key>Display</key>
<dict>
<key>ConsoleFont</key>
<string>Menlo</string>
<key>ConsoleFontSize</key>
<integer>12</integer>
<key>ConsoleOnly</key>
<true/>
<key>ConsoleTheme</key>
<string>Default</string>
<key>DisplayDownscaler</key>
<string>linear</string>
<key>DisplayFitScreen</key>
<true/>
<key>DisplayUpscaler</key>
<string>linear</string>
</dict>
<key>Drives</key>
<array>
<dict>
<key>ImagePath</key>
<string>image.qcow2</string>
<key>ImageType</key>
<string>disk</string>
<key>InterfaceType</key>
<string>virtio</string>
</dict>
<dict>
<key>ImageType</key>
<string>cd</string>
<key>InterfaceType</key>
<string>usb</string>
<key>Removable</key>
<true/>
</dict>
</array>
<key>Info</key>
<dict>
<key>Icon</key>
<string>Penguin.png</string>
<key>IconCustom</key>
<true/>
<key>Notes</key>
<string>Default user/initial password: opc/opc
Root password: locked</string>
</dict>
<key>Input</key>
<dict>
<key>InputLegacy</key>
<false/>
</dict>
<key>Networking</key>
<dict>
<key>NetworkCard</key>
<string>virtio-net-device</string>
<key>NetworkEnabled</key>
<true/>
</dict>
<key>Printing</key>
<dict/>
<key>Sharing</key>
<dict>
<key>ClipboardSharing</key>
<true/>
<key>DirectoryName</key>
<string></string>
<key>DirectorySharing</key>
<false/>
</dict>
<key>Sound</key>
<dict>
<key>SoundCard</key>
<string>hda</string>
<key>SoundEnabled</key>
<true/>
</dict>
<key>System</key>
<dict>
<key>Architecture</key>
<string>aarch64</string>
<key>BootDevice</key>
<string>hdd</string>
<key>CPUCount</key>
<integer>0</integer>
<key>ForceMulticore</key>
<false/>
<key>JITCacheSize</key>
<integer>0</integer>
<key>MachineProperties</key>
<string>highmem=off</string>
<key>Memory</key>
<integer>2048</integer>
<key>SystemUUID</key>
<string>00000000-0000-0000-0000-000000000000</string>
<key>Target</key>
<string>virt</string>
</dict>
</dict>
</plist>
38 changes: 38 additions & 0 deletions oracle-linux-image-tools/cloud/utm/image-scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
#
# Cleanup and package image for the "None" image
#
# Copyright (c) 2022 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at
# https://oss.oracle.com/licenses/upl
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#

#######################################
# Image packaging:
# For VistualBox we convert back to VMDK and re-create the OVA file
# For qemu we convert to a qcow2 file
# Globals:
# CLOUD_DIR CLOUD
# VM_NAME
# Arguments:
# None
# Returns:
# None
#######################################
cloud::image_package() {
local utm_dir uuid
utm_dir="${VM_NAME}.utm"
mkdir -p "${utm_dir}/Images"
common::convert_to_qcow2 "${utm_dir}/Images/${VM_NAME}.qcow2"
cp "${CLOUD_DIR}/${CLOUD}/Penguin.png" "${utm_dir}"
uuid=$(python3 -c "import uuid; print(str(uuid.uuid4()).upper())")
sed \
-e "s/image.qcow2/${VM_NAME}.qcow2/" \
-e "s!opc/opc!opc/${SSH_PASSWORD}!" \
-e "s/00000000-0000-0000-0000-000000000000/${uuid}/" \
"${CLOUD_DIR}/${CLOUD}/config.plist" > "${utm_dir}/config.plist"
zip -r "${utm_dir}.zip" "${utm_dir}"
rm -rf "${utm_dir}"
}
31 changes: 31 additions & 0 deletions oracle-linux-image-tools/cloud/utm/provision.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
#
# Packer provisioning script for UTM
#
# Copyright (c) 2022 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at
# https://oss.oracle.com/licenses/upl
#
# Description: UTM specific provisioning.n
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#

#######################################
# Provisioning module
# Globals:
# None
# Arguments:
# None
# Returns:
# None
#######################################
cloud::provision()
{
hash=$(/usr/libexec/platform-python -c "import crypt; print(crypt.crypt('${SSH_PASSWORD}', crypt.METHOD_SHA512))")
useradd opc -c "Oracle Public Cloud User" -G wheel -m -p "${hash}"
passwd -e opc
echo "%opc ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/opc
chmod 0440 /etc/sudoers.d/opc
restorecon /etc/sudoers.d/opc
}