Path: blob/master/pkg/cidata/cidata.TEMPLATE.d/boot/07-etc-environment.sh
2661 views
#!/bin/sh12# SPDX-FileCopyrightText: Copyright The Lima Authors3# SPDX-License-Identifier: Apache-2.045set -eux67# /etc/environment must be written after 04-persistent-data-volume.sh has run to8# make sure the changes on a restart are applied to the persisted version.910orig=$(test ! -f /etc/environment || cat /etc/environment)11if [ -e /etc/environment ]; then12sed -i '/#LIMA-START/,/#LIMA-END/d' /etc/environment13fi14cat "${LIMA_CIDATA_MNT}/etc_environment" >>/etc/environment1516# It is possible that a requirements script has started an ssh session before17# /etc/environment was updated, so we need to kill it to make sure it will18# restart with the updated environment before "linger" is being enabled.1920if command -v loginctl >/dev/null 2>&1 && [ "${orig}" != "$(cat /etc/environment)" ]; then21loginctl terminate-user "${LIMA_CIDATA_USER}" || true22fi2324# Signal that provisioning is done. The instance-id in the meta-data file changes on every boot,25# so any copy from a previous boot cycle will have different content.26cp "${LIMA_CIDATA_MNT}"/meta-data /run/lima-ssh-ready272829