From 2a658502e6aba8da3998249776c4fd118919eadc Mon Sep 17 00:00:00 2001 From: 01micko <01micko@gmail.com> Date: Sun, 12 Jan 2020 06:17:01 +1000 Subject: [PATCH] fix date and version in the manual page This somewhat saves updating the man page each time there is a verion bump --- installer.sh | 7 +++++++ usr/share/man/man1/pkg.1 | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/installer.sh b/installer.sh index 565c814..83e33f4 100755 --- a/installer.sh +++ b/installer.sh @@ -26,6 +26,13 @@ do [ -f $existing_file ] && mv $existing_file /root/.pkg/ done +# fix version and date in man page - get version from recently installed +VER=$(while read ver; do [ "${ver:0:6}" = 'APPVER' ] && ver=${ver#*=} && ver=${ver/\"/} && ver=${ver/\"/} && echo $ver && break;done < /usr/sbin/pkg) +DATE="$(date '+%B %Y')" +sed -e "s/VERSION_PLACEHOLDER/$VER/g" \ + -e "s/DATE_PLACEHOLDER/$DATE/" \ + < usr/share/man/man1/pkg.1 > /usr/share/man/man1/pkg.1 + [ -s ~/.packages/${pkgname}.files ] && echo -e "Package contents listed in ~/.packages/${pkgname}.files \n" echo -e "Setting up Pkg... \n" diff --git a/usr/share/man/man1/pkg.1 b/usr/share/man/man1/pkg.1 index ad5c119..aeb8e48 100644 --- a/usr/share/man/man1/pkg.1 +++ b/usr/share/man/man1/pkg.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4. -.TH PKG "1" "December 2017" "Pkg 1.9.19alpha" "User Commands" +.TH PKG "1" "DATE_PLACEHOLDER" "Pkg VERSION_PLACEHOLDER" "User Commands" .SH NAME Pkg .SH VERSION -1.9.17alpha +VERSION_PLACEHOLDER .SH SYNOPSIS .B pkg [OPTION(S)] PKGNAME|FILENAME|SEARCH