From 071929539b26dfcb0fa3887e2fd6c0224ff2e5df Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 12 Oct 2017 10:51:29 +0200 Subject: Extract version from manifest in bootstrap script --- bootstrap | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'bootstrap') diff --git a/bootstrap b/bootstrap index 4c2834f..a898be4 100755 --- a/bootstrap +++ b/bootstrap @@ -97,6 +97,14 @@ if [ "$stage" -lt "1" -o "$stage" -gt "$stage_max" ]; then error "invalid stage number $stage" fi +# Extract version. +# +version="$(sed -n -re 's/^version: ([0-9]+\.[0-9]+\.[0-9]+).*$/\1/p' ./manifest)" +version_id="$(sed -n -re 's/^([0-9]+\.[0-9]+)\.[0-9]+$/\1/p' <<<"$version")" +if [ -z "$version" -o -z "$version_id" ]; then + error "unable to extract version from manifest" +fi + # Btrfs subvolume manipulation. # function subvol_delete () # @@ -244,24 +252,24 @@ chattr +i /etc/localtime # cat </etc/os-release NAME="Build OS" -VERSION="0.6.0" +VERSION="$version" ID=buildos ID_LIKE=debian -PRETTY_NAME="Build OS 0.6.0 (Based on Debian)" -VERSION_ID="0.6" +PRETTY_NAME="Build OS $version (Based on Debian)" +VERSION_ID="$version_id" HOME_URL="https://build2.org/" SUPPORT_URL="https://lists.build2.org/" BUG_REPORT_URL="https://lists.build2.org/" EOF1 cat </etc/issue -Build OS 0.6.0 (Based on Debian) \n \l +Build OS $version (Based on Debian) \n \l EOF1 cat </etc/motd -Welcome to Build OS 0.6.0 (https://build2.org)! +Welcome to Build OS $version (https://build2.org)! EOF1 -- cgit v1.1