Skip to content

Commit 94287d7

Browse files
committed
board/common: store version files in /usr/lib, symlink from /etc
Users commonly mount volumes over /etc and /var to persist config. With /etc/os-release and /etc/version as plain files they get frozen at the version the container was first started and won't reflect image upgrades. Move the content to /usr/lib/os-release and /usr/lib/version (outside any volume mounts), and create /etc/os-release and /etc/version as symlinks into /usr/lib/. The motd chain (/etc/motd -> version -> /etc/version -> /usr/lib/version) continues to work as before. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
1 parent b3da3e6 commit 94287d7

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

board/common/post-build.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ rm "${TARGET_DIR}/etc/network/interfaces"
1212
VERSION="${CURIOS_VERSION}"
1313
GIT_VERSION="${CURIOS_BUILD_ID}"
1414

15-
# Buildroot original remain in /usr/lib/os-release
16-
rm "${TARGET_DIR}/etc/os-release"
17-
cat <<-EOF >"${TARGET_DIR}/etc/os-release"
15+
# Overwrite Buildroot's /usr/lib/os-release with curiOS content.
16+
# /etc/os-release is a symlink -> ../usr/lib/os-release, so it keeps
17+
# resolving correctly even when /etc is volume-mounted and the image
18+
# is upgraded underneath it.
19+
cat <<-EOF >"${TARGET_DIR}/usr/lib/os-release"
1820
NAME="curiOS"
1921
ID=curios
2022
PRETTY_NAME="$tagline $VERSION"
@@ -27,6 +29,8 @@ cat <<-EOF >"${TARGET_DIR}/etc/os-release"
2729
VENDOR_HOME="https://github.com/kernelkit"
2830
SUPPORT_URL="mailto:kernelkit@googlegroups.com"
2931
EOF
32+
ln -sf ../usr/lib/os-release "${TARGET_DIR}/etc/os-release"
3033

31-
echo "$tagline $VERSION$(date +"%b %e %H:%M %Z %Y")" > "$TARGET_DIR/etc/version"
34+
echo "$tagline $VERSION$(date +"%b %e %H:%M %Z %Y")" > "$TARGET_DIR/usr/lib/version"
35+
ln -sf ../usr/lib/version "$TARGET_DIR/etc/version"
3236
ln -sf version "$TARGET_DIR/etc/motd"

0 commit comments

Comments
 (0)