From ea08809a7510f1fafa1a5d818933c6cddffe5f69 Mon Sep 17 00:00:00 2001
From: piterpunk <piterpunk@slackware.com>
Date: Sun, 7 Nov 2021 14:01:54 -0300
Subject: Automatically rebuild package lists if missing

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

(limited to 'files')

diff --git a/files/core-functions.sh b/files/core-functions.sh
index 5969ffc..463a190 100644
--- a/files/core-functions.sh
+++ b/files/core-functions.sh
@@ -243,11 +243,9 @@ ONE mirror in ${CONF}/mirrors and run:\n\n\
 You can see more information about slackpkg functions in slackpkg manpage."
 			cleanup
 		elif [ "$CMD" != "new-config" ] && [ "$CMD" != "help" ]; then
-			echo -e "\
-\nThe package list is missing.\n\
-Before you install|upgrade|reinstall anything you need to run:\n\n\
-\t# slackpkg update\n"
-			cleanup
+			updatefilelists
+			mkregex_blacklist
+			UPDATED=1
 		fi
 	fi                                                      
 
@@ -1083,6 +1081,7 @@ Please check your mirror and try again."
 
 function updatefilelists()
 {
+	echo "Updating the package lists..."
 	if checkchangelog ; then
 		echo -e "\
 \n\t\tNo changes in ChangeLog.txt between your last update and now.\n\
diff --git a/files/slackpkg b/files/slackpkg
index de02d05..9fc7f5d 100644
--- a/files/slackpkg
+++ b/files/slackpkg
@@ -328,7 +328,7 @@ case "$CMD" in
 	check-updates)
 		# output to stdout if no change, or stderr if changes. Will cause
 		# cron jobs to notify system admin
-		if checkchangelog 1>/dev/null 2>/dev/null ; then
+		if checkchangelog 1>/dev/null 2>/dev/null && [ "$UPDATED" != "1" ] ; then
 			echo "Slackpkg: No updated packages since last check."
 		else
 			echo "Slackpkg: Updated packages are available since last check." >&2
@@ -356,7 +356,6 @@ case "$CMD" in
 				cleanup
 			fi
 		fi
-		echo "Updating the package lists..."
 		updatefilelists
 	;;
 	install)
-- 
cgit v1.2.3