From 23640d912ddf754934488a002070581fee2dbc77 Mon Sep 17 00:00:00 2001
From: Peter Hyman <pete@peterhyman.com>
Date: Sun, 3 Jan 2021 10:12:29 -0600
Subject: Add show-changelog option and update manpage

Signed-off-by: Robby Workman <rworkman@slackware.com>
---
 files/core-functions.sh |  3 ++-
 files/slackpkg          | 11 ++++++++++-
 files/slackpkg.8        |  7 ++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

(limited to 'files')

diff --git a/files/core-functions.sh b/files/core-functions.sh
index c2891f5..f8be890 100644
--- a/files/core-functions.sh
+++ b/files/core-functions.sh
@@ -426,7 +426,7 @@ slackpkg - version $VERSION\n\
 \tslackpkg [OPTIONS] info PACKAGE
 \tslackpkg [OPTIONS] update [gpg]
 \tslackpkg [OPTIONS] {clean-system|upgrade-all|install-new}
-\tslackpkg [OPTIONS] {new-config|check-updates|help}
+\tslackpkg [OPTIONS] {new-config|check-updates|show-changelog|help}
 \nIf you need more information try to use 'slackpkg help' or look the\n\
 slackpkg's manpage.
 "
@@ -440,6 +440,7 @@ slackpkg - version $VERSION\n\
 \t\t\t\t\tpackage indexes
 \tslackpkg check-updates\t\tcheck if there is any news on
 \t\t\t\t\tSlackware's ChangeLog.txt
+\tslackpkg show-changelog\t\tshow Slackware ChangeLog.txt and exit
 \tslackpkg install package\tdownload and install packages 
 \tslackpkg upgrade package\tdownload and upgrade packages
 \tslackpkg reinstall package\tsame as install, but for packages 
diff --git a/files/slackpkg b/files/slackpkg
index f579ea3..b616a6a 100644
--- a/files/slackpkg
+++ b/files/slackpkg
@@ -246,7 +246,7 @@ while [ -n "$1" ] ; do
         shift
       fi
     ;;
-    install-new|upgrade-all|clean-system|new-config|check-updates|help)
+    install-new|upgrade-all|clean-system|new-config|check-updates|show-changelog|help)
       CMD=$1
       shift
       if [ -n "$1" ]; then
@@ -326,6 +326,15 @@ case "$CMD" in
 			echo "Slackpkg: Updated packages are available since last check." >&2
 		fi
 		;;
+	show-changelog)
+		# display changelog and exit
+		if [ -e ${ROOT}/${WORKDIR}/ChangeLog.txt ]; then
+			$MORECMD ${ROOT}/${WORKDIR}/ChangeLog.txt
+		else
+			echo "ChangeLog.txt file not found. Aborting"
+		fi
+		POSTINST=off
+		;;
 	update)
 		# If you are using "slackpkg update gpg" OR the system
 		# doesn't have Slackware GPG key, download and install
diff --git a/files/slackpkg.8 b/files/slackpkg.8
index 02da92f..2f628b9 100644
--- a/files/slackpkg.8
+++ b/files/slackpkg.8
@@ -26,7 +26,7 @@
 
 .B slackpkg [OPTIONS] update [gpg]
 
-.B slackpkg [OPTIONS] {new-config|check-updates}
+.B slackpkg [OPTIONS] {new-config|check-updates|show-changelog}
 
 .B slackpkg [OPTIONS] help
 
@@ -153,6 +153,11 @@ once and forget it...
 Verify if there is any update to ChangeLog.txt. This is good to be used from
 cron to alert the sysadmin about updates.
 
+.TP 5
+.B show-changelog
+.br
+Display Slackware ChangeLog.txt file and exit.
+
 .TP 5
 .B file-search
 .br
-- 
cgit v1.2.3