Skip to content
Open
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
12 changes: 9 additions & 3 deletions pkg/cidata/cidata.TEMPLATE.d/boot/00-reboot-if-required.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@

set -eux

[ "$LIMA_CIDATA_UPGRADE_PACKAGES" = "1" ] || exit 0

# Check if cloud-init forgot to reboot_if_required
# (only implemented for apt at the moment, not dnf)

if command -v dnf >/dev/null 2>&1; then
# dnf-utils needs to be installed, for needs-restarting
if dnf -h needs-restarting >/dev/null 2>&1; then
# needs-restarting returns "false" if needed (!)
if ! dnf needs-restarting -r >/dev/null 2>&1; then
systemctl reboot
# check-update returns "false" (100) if updates (!)
dnf check-update >/dev/null
if [ "$?" != "1" ]; then
# needs-restarting returns "false" if needed (!)
if ! dnf needs-restarting -r; then
systemctl reboot
fi
fi
fi
fi
5 changes: 5 additions & 0 deletions pkg/cidata/cidata.TEMPLATE.d/lima.env
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ LIMA_CIDATA_YQ_PROVISION_{{$yqProvision.FileName}}_PATH={{$yqProvision.Path}}
LIMA_CIDATA_YQ_PROVISION_{{$yqProvision.FileName}}_PERMISSIONS={{$yqProvision.Permissions}}
{{- end}}
LIMA_CIDATA_GUEST_INSTALL_PREFIX={{ .GuestInstallPrefix }}
{{- if .UpgradePackages}}
LIMA_CIDATA_UPGRADE_PACKAGES=1
{{- else}}
LIMA_CIDATA_UPGRADE_PACKAGES=
{{- end}}
{{- if .Containerd.User}}
LIMA_CIDATA_CONTAINERD_USER=1
{{- else}}
Expand Down
Loading