summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren Austin <darren@afterdark.org.uk>2018-09-19 23:18:10 -0500
committerRobby Workman <rworkman@slackware.com>2018-09-19 23:21:58 -0500
commita805617e8160e0a6257d882cec933115806f8bf1 (patch)
tree664b6ecdbbf5efe02e9f95e386dd9b4668955648
parentff0b9ff70a6031e712035e98b1dd2845774cb137 (diff)
downloadslackpkg-a805617e8160e0a6257d882cec933115806f8bf1.tar.xz
Add config option to allow *not* saving .orig configs
When admins choose to allow slackpkg new-config to overwrite currently installed config files with the .new counterparts from an upgraded package, slackpkg has traditionally created backups of the config files first, with the backups being written out with .orig extensions. This commit does not change the default behavior, but it does allow it to be turned off. TLDR: set "ORIG_BACKUPS" to "off" in /etc/slackpkg/slackpkg.conf if you do not wish to have .orig files left over Signed-off-by: Robby Workman <rworkman@slackware.com>
-rw-r--r--files/post-functions.sh13
-rw-r--r--files/slackpkg8
-rw-r--r--files/slackpkg.conf.515
-rw-r--r--files/slackpkg.conf.new4
4 files changed, 34 insertions, 6 deletions
diff --git a/files/post-functions.sh b/files/post-functions.sh
index b3beac8..ca61b2d 100644
--- a/files/post-functions.sh
+++ b/files/post-functions.sh
@@ -47,7 +47,7 @@ mergenew() {
;;
I|i)
if [ -f "${FULLNAME}.smerge" ]; then
- if [ -e "${FULLNAME}" ]; then
+ if [ -e "${FULLNAME}" ] && [ "$ORIG_BACKUPS" != "off" ]; then
mv "${FULLNAME}" "${FULLNAME}.orig"
fi
mv "${FULLNAME}.smerge" "${FULLNAME}"
@@ -101,7 +101,7 @@ overold() {
FILEPATH=$(dirname $i)
FULLNAME="${FILEPATH}/${BASENAME}"
- if [ -e ${FULLNAME} ]; then
+ if [ -e ${FULLNAME} ] && [ "$ORIG_BACKUPS" != "off" ]; then
mv ${FULLNAME} ${FULLNAME}.orig
fi
mv ${FULLNAME}.new ${FULLNAME}
@@ -141,15 +141,16 @@ looknew() {
-not -name "shadow.new" \
-not -name "gshadow.new" 2>/dev/null | sort 2>/dev/null)
if [ "$FILES" != "" ]; then
- echo -e "\n\
+ echo -ne "\n\
Some packages had new configuration files installed.
You have four choices:
(K)eep the old files and consider .new files later
- (O)verwrite all old files with the new ones. The
- old files will be stored with the suffix .orig
-
+ (O)verwrite all old files with the new ones"
+ [ "$ORIG_BACKUPS" != "off" ] && echo -ne ". The
+ old files will be stored with the suffix .orig"
+ echo -e "\n\n\
(R)emove all .new files
(P)rompt K, O, R selection for every single file
diff --git a/files/slackpkg b/files/slackpkg
index 6786493..52f8c9b 100644
--- a/files/slackpkg
+++ b/files/slackpkg
@@ -178,6 +178,14 @@ while [ -n "$1" ] ; do
ONLY_NEW_DOTNEW=off
shift
;;
+ -orig_backups=on)
+ ORIG_BACKUPS=on
+ shift
+ ;;
+ -orig_backups=off)
+ ORIG_BACKUPS=off
+ shift
+ ;;
-use_includes=on)
USE_INCLUDES=on
shift
diff --git a/files/slackpkg.conf.5 b/files/slackpkg.conf.5
index 5af259a..10c9576 100644
--- a/files/slackpkg.conf.5
+++ b/files/slackpkg.conf.5
@@ -211,6 +211,21 @@ is "off". Only change this if you know what are you doing...
From command line, you can use -only_new_dotnew=value.
.TP 5
+.B ORIG_BACKUPS
+.br
+During integration of .new files during the post installation phase, original
+files are backed up to a file name with a .orig extension. To prevent this,
+set this option to "off" and note that you will no longer have a copy of the
+content of the file prior to it being replaced by the .new version.
+
+The default value of
+.B ORIG_BACKUPS
+is "on". Only change this if you are sure you don't want backups of
+overwritten files.
+.br
+From the command line, you can use -orig_backups=value.
+
+.TP 5
.B ONOFF
.br
The
diff --git a/files/slackpkg.conf.new b/files/slackpkg.conf.new
index 9eae0ab..4c15538 100644
--- a/files/slackpkg.conf.new
+++ b/files/slackpkg.conf.new
@@ -109,6 +109,10 @@ POSTINST=on
# Default=off
ONLY_NEW_DOTNEW=off
+# Whether to backup files overwritten by their .new counterparts with a
+# .orig extension.
+ORIG_BACKUPS=on
+
# The ONOFF variable sets the initial behavior of the dialog interface.
# If you set this to "on" then all packages will be selected by default.
# If you prefer the opposite option (all unchecked), then set this to "off".