-
Notifications
You must be signed in to change notification settings - Fork 625
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #362 from rancher-sandbox/etc-environment
Write /etc/environment before the lingering session is started
- Loading branch information
Showing
7 changed files
with
101 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
set -eux | ||
|
||
# /etc/environment must be written after 05-persistent-data-volume.sh has run to | ||
# make sure the changes on a restart are applied to the persisted version. | ||
|
||
if [ -e /etc/environment ]; then | ||
sed -i '/#LIMA-START/,/#LIMA-END/d' /etc/environment | ||
fi | ||
cat "${LIMA_CIDATA_MNT}/etc_environment" >>/etc/environment | ||
|
||
# It is possible that a requirements script has started an ssh session before | ||
# /etc/environment was updated, so we need to kill it to make sure it will | ||
# restart with the updated environment before "linger" is being enabled. | ||
|
||
if command -v loginctl >/dev/null 2>&1; then | ||
loginctl terminate-user "${LIMA_CIDATA_USER}" || true | ||
fi | ||
|
||
# Make sure the guestagent socket from a previous boot is removed before we open the "lima-ssh-ready" gate. | ||
rm -f /run/lima-guest-agent.sock | ||
|
||
# Signal that provisioning is done. The instance-id in the meta-data file changes on every boot, | ||
# so any copy from a previous boot cycle will have different content. | ||
cp "${LIMA_CIDATA_MNT}"/meta-data /run/lima-ssh-ready |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters