Skip to content

Commit b56b3be

Browse files
authored
Merge pull request #21 from lima-vm/os-version
Add `BUILD_ID` and `VARIANT_ID` to `/etc/os-release`
2 parents 2bfd604 + 98f3ace commit b56b3be

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
ALPINE_VERSION ?= 3.13.5
22
REPO_VERSION ?= $(shell echo "$(ALPINE_VERSION)" | sed -E 's/^([0-9]+\.[0-9]+).*/v\1/')
33
GIT_TAG ?= $(shell echo "v$(ALPINE_VERSION)" | sed 's/^vedge$$/origin\/master/')
4+
BUILD_ID ?= $(shell git describe --tags)
45

56
# Editions should be 5 chars or less because the full name is used as
67
# the volume id, and cannot exceed 32 characters.
78
# len("alpine-lima-12345-3.13.5-x86_64") == 31
89
EDITION ?= std
910

10-
NERDCTL_VERSION=0.11.1
11+
NERDCTL_VERSION=0.12.1
1112

1213
.PHONY: mkimage
1314
mkimage:
@@ -19,7 +20,7 @@ mkimage:
1920

2021
.PHONY: iso
2122
iso: nerdctl-$(NERDCTL_VERSION)
22-
ALPINE_VERSION=$(ALPINE_VERSION) NERDCTL_VERSION=$(NERDCTL_VERSION) REPO_VERSION=$(REPO_VERSION) EDITION=$(EDITION) ./build.sh
23+
ALPINE_VERSION=$(ALPINE_VERSION) NERDCTL_VERSION=$(NERDCTL_VERSION) REPO_VERSION=$(REPO_VERSION) EDITION=$(EDITION) BUILD_ID=$(BUILD_ID) ./build.sh
2324

2425
nerdctl-$(NERDCTL_VERSION):
2526
curl -o $@ -Ls https://github.com/containerd/nerdctl/releases/download/v$(NERDCTL_VERSION)/nerdctl-full-$(NERDCTL_VERSION)-linux-amd64.tar.gz

build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ docker run -it --rm \
1919
-v "${PWD}/sshd.pam:/home/build/sshd.pam:ro" \
2020
$(env | grep ^LIMA_ | xargs -n 1 printf -- '-e %s ') \
2121
-e "LIMA_REPO_VERSION=${REPO_VERSION}" \
22+
-e "LIMA_BUILD_ID=${BUILD_ID}" \
23+
-e "LIMA_VARIANT_ID=${EDITION}" \
2224
"mkimage:${ALPINE_VERSION}" \
2325
--tag "${TAG}" \
2426
--outdir /iso \

genapkovl-lima.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ mkdir -p "${tmp}/etc/local.d/"
7979
makefile root:root 0755 "$tmp/etc/local.d/lima.start" << EOF
8080
sed -i 's/#UsePAM no/UsePAM yes/g' /etc/ssh/sshd_config
8181
rc-service --ifstarted sshd reload
82+
83+
if ! grep -q BUILD_ID /etc/os-release; then
84+
echo "BUILD_ID=\"${LIMA_BUILD_ID}\"" >> /etc/os-release
85+
echo "VARIANT_ID=\"${LIMA_VARIANT_ID}\"" >> /etc/os-release
86+
fi
8287
EOF
8388

8489
mkdir -p "$tmp"/etc/pam.d

0 commit comments

Comments
 (0)