summaryrefslogtreecommitdiffstats
path: root/files/post-functions.sh
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 /files/post-functions.sh
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>
Diffstat (limited to 'files/post-functions.sh')
-rw-r--r--files/post-functions.sh13
1 files changed, 7 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