Skip to content

Commit

Permalink
fixed indentation on cloud-init extension
Browse files Browse the repository at this point in the history
  • Loading branch information
rafael committed Jan 31, 2024
1 parent ad9e3a0 commit 815f451
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
48 changes: 24 additions & 24 deletions extensions/cloud-init/cloud-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,51 +22,51 @@ function extension_prepare_config__ci_image_suffix() {
}

function extension_prepare_config__prepare_ci() {
# Cloud Init related packages selected from Ubuntu RPI distirbution
add_packages_to_image cloud-init cloud-initramfs-dyn-netconf
# Cloud Init related packages selected from Ubuntu RPI distirbution
add_packages_to_image cloud-init cloud-initramfs-dyn-netconf
}

function extension_prepare_config__ci_compatibility_check(){
# We require fat boot partition, will change and if the user provided another type, will fail.
if [[ -z "${BOOTFS_TYPE}" ]]; then
declare -g BOOTFS_TYPE="fat"
display_alert "Changing BOOTFS_TYPE" "cloud_init requires a fat partition" "warn"
fi

if [[ "${BOOTFS_TYPE}" != "fat" ]]; then
exit_with_error "BOOTFS_TYPE ${BOOTFS_TYPE} not compatible with cloud-init"
fi
# We require fat boot partition, will change and if the user provided another type, will fail.
if [[ -z "${BOOTFS_TYPE}" ]]; then
declare -g BOOTFS_TYPE="fat"
display_alert "Changing BOOTFS_TYPE" "cloud_init requires a fat partition" "warn"
fi

if [[ "${BOOTFS_TYPE}" != "fat" ]]; then
exit_with_error "BOOTFS_TYPE ${BOOTFS_TYPE} not compatible with cloud-init"
fi
}

function pre_customize_image__inject_cloud_init_config() {
# Copy the NoCLoud Cloud-Init Configuration
# Copy the NoCLoud Cloud-Init Configuration
display_alert "Configuring" "cloud-init" "info"
local config_src="${EXTENSION_DIR}/config"
local config_dst="${SDCARD}/etc/cloud/cloud.cfg.d"
run_host_command_logged cp ${config_src}/* $config_dst
run_host_command_logged cp ${config_src}/* $config_dst

# Provide default cloud-init files
# Provide default cloud-init files
display_alert "Defaults" "cloud-init" "info"
local defaults_src="${EXTENSION_DIR}/defaults"
local defaults_dst="${SDCARD}/boot"
run_host_command_logged cp ${defaults_src}/* $defaults_dst
run_host_command_logged cp ${defaults_src}/* $defaults_dst
return 0
}


# @TODO: would be better to have "armbian first run" as an extension that can be disabled
function pre_customize_image__disable_armbian_first_run() {
display_alert "Disabling" "armbian first run" "info"
display_alert "Disabling" "armbian first run" "info"

# Clean up default profile and network
rm -f ${SDCARD}/etc/profile.d/armbian-check-first-*
rm -f ${SDCARD}/etc/netplan/armbian-*
# Clean up default profile and network
rm -f ${SDCARD}/etc/profile.d/armbian-check-first-*
rm -f ${SDCARD}/etc/netplan/armbian-*

# remove any networkd config leftover from armbian build
rm -f "${SDCARD}"/etc/systemd/network/*.network || true
# remove any networkd config leftover from armbian build
rm -f "${SDCARD}"/etc/systemd/network/*.network || true

# cleanup -- cloud-init makes some Armbian stuff actually get in the way
[[ -f "${SDCARD}/boot/armbian_first_run.txt.template" ]] && rm -f "${SDCARD}/boot/armbian_first_run.txt.template"
[[ -f "${SDCARD}/root/.not_logged_in_yet" ]] && rm -f "${SDCARD}/root/.not_logged_in_yet"
# cleanup -- cloud-init makes some Armbian stuff actually get in the way
[[ -f "${SDCARD}/boot/armbian_first_run.txt.template" ]] && rm -f "${SDCARD}/boot/armbian_first_run.txt.template"
[[ -f "${SDCARD}/root/.not_logged_in_yet" ]] && rm -f "${SDCARD}/root/.not_logged_in_yet"

}
2 changes: 1 addition & 1 deletion extensions/cloud-init/defaults/network-config
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ ethernets:
dhcp4: true
optional: true
match:
name: "en*,eth*"
name: "en*,eth*"
2 changes: 1 addition & 1 deletion extensions/cloud-init/defaults/network-config.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ethernets:
dhcp4: true
optional: true
match:
name: "en*,eth*"
name: "en*,eth*"

# Static Ethernet Example

Expand Down

0 comments on commit 815f451

Please sign in to comment.