|
|
|
looknew() {
|
|
|
|
|
|
|
|
# with ONLY_NEW_DOTNEW set, slackpkg will search only for
|
|
|
|
# .new files installed in actual slackpkg's execution
|
|
|
|
if [ "$ONLY_NEW_DOTNEW" = "on" ]; then
|
|
|
|
ONLY_NEW_DOTNEW="-cnewer $TMPDIR/timestamp"
|
|
|
|
else
|
|
|
|
ONLY_NEW_DOTNEW=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "\nSearching for NEW configuration files"
|
|
|
|
FILES=""
|
|
|
|
|
|
|
|
find /var/log/packages -maxdepth 1 -type f ${ONLY_NEW_DOTNEW} | xargs sed -n -e '/^FILE LIST:$/,/^$/p' | fgrep -xv 'FILE LIST:' | sort | uniq > $TMPDIR/allfiles
|
|
|
|
|
|
|
|
local IFS=$'\n'
|
|
|
|
for f in $(grep '\.new$' $TMPDIR/allfiles | sed -e 's/\.new$//'); do
|
|
|
|
x=$f.new
|
|
|
|
if [ -f "/$f" -a -f "/$x" ]; then
|
|
|
|
if ! fgrep -x "$f" $TMPDIR/allfiles 1> /dev/null 2>&1; then
|
|
|
|
FILES+="/$x
|
|
|
|
"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "$FILES" != "" ]; then
|
|
|
|
echo -e "\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
|
|
|
|
|
|
|
|
(R)emove all .new files
|
|
|
|
|
|
|
|
(P)rompt K, O, R selection for every single file
|
|
|
|
|
|
|
|
What do you want (K/O/R/P)?"
|
|
|
|
answer
|
|
|
|
case $ANSWER in
|
|
|
|
K|k)
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
O|o)
|
|
|
|
for i in $FILES; do
|
|
|
|
overold $i
|
|
|
|
done
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
R|r)
|
|
|
|
for i in $FILES; do
|
|
|
|
removeold $i
|
|
|
|
done
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
P|p)
|
|
|
|
echo "Select what you want file-by-file"
|
|
|
|
for i in $FILES; do
|
|
|
|
GOEX=0
|
|
|
|
while [ $GOEX -eq 0 ]; do
|
|
|
|
echo
|
|
|
|
showmenu $i "(K)eep" "(O)verwrite" "(R)emove" "(D)iff" "(M)erge"
|
|
|
|
read ANSWER
|
|
|
|
case $ANSWER in
|
|
|
|
O|o)
|
|
|
|
overold $i
|
|
|
|
GOEX=1
|
|
|
|
;;
|
|
|
|
R|r)
|
|
|
|
removeold $i
|
|
|
|
GOEX=1
|
|
|
|
;;
|
|
|
|
D|d)
|
|
|
|
showdiff $1
|
|
|
|
;;
|
|
|
|
M|m)
|
|
|
|
mergenew $1
|
|
|
|
;;
|
|
|
|
K|k|*)
|
|
|
|
GOEX=1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
done
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "OK! Your choice is nothing! slackpkg will Keep the old files for you to deal with later"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
echo -e "\t\tNo .new files found."
|
|
|
|
fi
|
|
|
|
}
|