Fix a problem with how mergemaster handles the hard links for /.cshrc
and /.profile. The problem is that install(1) will unlink the old file before it installs the new one, which means that in the best case we have to compare the changes for the old file twice. So, change the logic to first test to see if the link exists, then install the file. Then if the link was there and we're using -i, just create the link in /root and be done with it. Otherwise display the message to the user and give them the option. Because we are now sorting things before doing the comparison we can know conclusively that the files in / should be the sources, and the files in /root will be the targets, so adjust the paths accordingly. While I'm here, split a too-long error message into two lines and just return at the end of handling these files instead of setting the variable that says "do nothing" and then returning at the end of the function anyway.
This commit is contained in:
parent
98e47f9dfe
commit
d90331f910
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=200708
@ -840,8 +840,19 @@ mm_install () {
|
|||||||
DONT_INSTALL=yes
|
DONT_INSTALL=yes
|
||||||
;;
|
;;
|
||||||
/.cshrc | /.profile)
|
/.cshrc | /.profile)
|
||||||
case "${AUTO_INSTALL}" in
|
local st_nlink
|
||||||
'')
|
|
||||||
|
# install will unlink the file before it installs the new one,
|
||||||
|
# so we have to restore/create the link afterwards.
|
||||||
|
#
|
||||||
|
st_nlink=0 # In case the file does not yet exist
|
||||||
|
eval $(stat -s ${DESTDIR}${COMPFILE#.} 2>/dev/null)
|
||||||
|
|
||||||
|
do_install_and_rm "${FILE_MODE}" "${1}" "${DESTDIR}${INSTALL_DIR}"
|
||||||
|
|
||||||
|
if [ -n "${AUTO_INSTALL}" -a $st_nlink -gt 1 ]; then
|
||||||
|
HANDLE_LINK=l
|
||||||
|
else
|
||||||
case "${LINK_EXPLAINED}" in
|
case "${LINK_EXPLAINED}" in
|
||||||
'')
|
'')
|
||||||
echo " *** Historically BSD derived systems have had a"
|
echo " *** Historically BSD derived systems have had a"
|
||||||
@ -855,17 +866,13 @@ mm_install () {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
echo " Use 'd' to delete the temporary ${COMPFILE}"
|
echo " Use 'd' to delete the temporary ${COMPFILE}"
|
||||||
echo " Use 'l' to delete the existing ${DESTDIR}${COMPFILE#.} and create the link"
|
echo " Use 'l' to delete the existing ${DESTDIR}/root/${COMPFILE##*/} and create the link"
|
||||||
echo ''
|
echo ''
|
||||||
echo " Default is to leave the temporary file to deal with by hand"
|
echo " Default is to leave the temporary file to deal with by hand"
|
||||||
echo ''
|
echo ''
|
||||||
echo -n " How should I handle ${COMPFILE}? [Leave it to install later] "
|
echo -n " How should I handle ${COMPFILE}? [Leave it to install later] "
|
||||||
read HANDLE_LINK
|
read HANDLE_LINK
|
||||||
;;
|
fi
|
||||||
*) # Part of AUTO_INSTALL
|
|
||||||
HANDLE_LINK=l
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "${HANDLE_LINK}" in
|
case "${HANDLE_LINK}" in
|
||||||
[dD]*)
|
[dD]*)
|
||||||
@ -875,19 +882,19 @@ mm_install () {
|
|||||||
;;
|
;;
|
||||||
[lL]*)
|
[lL]*)
|
||||||
echo ''
|
echo ''
|
||||||
rm -f "${DESTDIR}${COMPFILE#.}"
|
unlink ${DESTDIR}/root/${COMPFILE##*/}
|
||||||
if ln "${DESTDIR}/root/${COMPFILE##*/}" "${DESTDIR}${COMPFILE#.}"; then
|
if ln ${DESTDIR}${COMPFILE#.} ${DESTDIR}/root/${COMPFILE##*/}; then
|
||||||
echo " *** Link from ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/} installed successfully"
|
echo " *** Link from ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/} installed successfully"
|
||||||
rm "${COMPFILE}"
|
|
||||||
else
|
else
|
||||||
echo " *** Error linking ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/}, ${COMPFILE} will remain to install by hand"
|
echo " *** Error linking ${DESTDIR}${COMPFILE#.} to ${DESTDIR}/root/${COMPFILE##*/}"
|
||||||
|
echo " *** ${COMPFILE} will remain for your consideration"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo " *** ${COMPFILE} will remain for your consideration"
|
echo " *** ${COMPFILE} will remain for your consideration"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
DONT_INSTALL=yes
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user