Skip to content

Commit

Permalink
Add option to install /usr/share/zoneinfo data
Browse files Browse the repository at this point in the history
and set timezone via lima-init.

Signed-off-by: Jan Dubois <[email protected]>
  • Loading branch information
jandubois committed Dec 22, 2023
1 parent 5cd42ea commit a1a387f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions edition/min
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export LIMA_INSTALL_NERDCTL_FULL=false
export LIMA_INSTALL_OPENSSH_SFTP_SERVER=false
export LIMA_INSTALL_SSHFS=false
export LIMA_INSTALL_TINI=false
export LIMA_INSTALL_ZONEINFO=false
export LIMA_INSTALL_ZSTD=false
1 change: 1 addition & 0 deletions edition/std
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ LIMA_INSTALL_LOGROTATE=true
LIMA_INSTALL_OPENSSH_SFTP_SERVER=true
LIMA_INSTALL_SSHFS=true
LIMA_INSTALL_TINI=true
LIMA_INSTALL_ZONEINFO=true
4 changes: 4 additions & 0 deletions genapkovl-lima.sh
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@ if [ "${LIMA_INSTALL_TINI}" == "true" ]; then
ln -sf /sbin/tini-static "$tmp"/usr/bin/tini
fi

if [ "${LIMA_INSTALL_ZONEINFO}" == "true" ]; then
echo tzdata >> "$tmp"/etc/apk/world
fi

if [ "${LIMA_INSTALL_CRI_DOCKERD}" == "true" ]; then
mkdir -p "${tmp}/cri-dockerd"
tar xz -C "${tmp}/cri-dockerd" -f /home/build/cri-dockerd.tar.gz
Expand Down
8 changes: 8 additions & 0 deletions lima-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ while read -r line; do export "$line"; done <"${LIMA_CIDATA_MNT}"/lima.env
LIMA_CIDATA_HOSTNAME="$(awk '/^local-hostname:/ {print $2}' "${LIMA_CIDATA_MNT}"/meta-data)"
hostname "${LIMA_CIDATA_HOSTNAME}"

# Set timezone
LIMA_CIDATA_TIMEZONE="$(awk '/^timezone:/ {print $2}' "${LIMA_CIDATA_MNT}"/user-data)"
if [ -n "${LIMA_CIDATA_TIMEZONE}" ]; then
if setup-timezone "${LIMA_CIDATA_TIMEZONE}"; then
echo "${LIMA_CIDATA_TIMEZONE}" >/etc/timezone
fi
fi

# Create user
LIMA_CIDATA_HOMEDIR="/home/${LIMA_CIDATA_USER}.linux"
useradd --home-dir "${LIMA_CIDATA_HOMEDIR}" --create-home --uid "${LIMA_CIDATA_UID}" "${LIMA_CIDATA_USER}"
Expand Down
3 changes: 3 additions & 0 deletions mkimg.lima.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,7 @@ profile_lima() {
if [ "${LIMA_INSTALL_ZSTD}" == "true" ]; then
apks="$apks zstd"
fi
if [ "${LIMA_INSTALL_ZONEINFO}" == "true" ]; then
apks="$apks tzdata"
fi
}

0 comments on commit a1a387f

Please sign in to comment.