Changeset View
Changeset View
Standalone View
Standalone View
share/mk/bsd.links.mk
# $FreeBSD$ | # $FreeBSD$ | ||||
.if !target(__<bsd.init.mk>__) | .if !target(__<bsd.init.mk>__) | ||||
.error bsd.links.mk cannot be included directly. | .error bsd.links.mk cannot be included directly. | ||||
.endif | .endif | ||||
.if defined(NO_ROOT) | .if defined(NO_ROOT) | ||||
.if !defined(TAGS) || ! ${TAGS:Mpackage=*} | .if !defined(TAGS) || ! ${TAGS:Mpackage=*} | ||||
TAGS+= package=${PACKAGE} | TAGS+= package=${PACKAGE} | ||||
.endif | .endif | ||||
TAG_ARGS= -T ${TAGS:[*]:S/ /,/g} | TAG_ARGS= -T ${TAGS:[*]:S/ /,/g} | ||||
.endif | .endif | ||||
afterinstall: _installlinks | afterinstall: _installlinks | ||||
.ORDER: realinstall _installlinks | .ORDER: realinstall _installlinks | ||||
# If the source and destination file are the same file (e.g. Mail/mail on a | |||||
# case-insensitive file-system) we have to pass -S to install(1) to avoid | |||||
# deleting the source file. | |||||
_installlinks: | _installlinks: | ||||
.for s t in ${LINKS} | .for s t in ${LINKS} | ||||
.if ${s:tl} == ${t:tl} | |||||
if test "${DESTDIR}${t}" -ef "${DESTDIR}${s}"; then \ | |||||
echo "Note: requested hard link from ${t} to ${s} on case-insensitive file system."; \ | |||||
fi | |||||
${INSTALL_LINK} -S ${TAG_ARGS} ${DESTDIR}${s} ${DESTDIR}${t} | |||||
imp: My first thought is 'why not include this always?'
I know Linux has a different -S flag, but… | |||||
arichardsonAuthorUnsubmitted Done Inline ActionsI'd be happy to add -S unconditionally, moving to a temporary file and renaming should not make much of a difference. I added this additional check in case this is considered too expensive. Should we always use -S, or only if tolower(source) == tolower(target)? arichardson: I'd be happy to add -S unconditionally, moving to a temporary file and renaming should not make… | |||||
impUnsubmitted Not Done Inline ActionsI'd been thinking of asking for unconditional. If you do it unconditionally, is there some measurable speed difference? imp: I'd been thinking of asking for unconditional. If you do it unconditionally, is there some… | |||||
brooksUnsubmitted Not Done Inline ActionsIn a quick and dirty benchmark there's a measurable difference doing 100k simple install's with and without -S, but we're talking ~72s vs ~105s. Given we only have ~1500 links in an install the actual difference might be a second at most. brooks: In a quick and dirty benchmark there's a measurable difference doing 100k simple install's with… | |||||
.else | |||||
${INSTALL_LINK} ${TAG_ARGS} ${DESTDIR}${s} ${DESTDIR}${t} | ${INSTALL_LINK} ${TAG_ARGS} ${DESTDIR}${s} ${DESTDIR}${t} | ||||
.endif | |||||
.endfor | .endfor | ||||
.for s t in ${SYMLINKS} | .for s t in ${SYMLINKS} | ||||
.if ${s:tl} == ${t:tl} | |||||
if test "${DESTDIR}${t}" -ef "${DESTDIR}${s}"; then \ | |||||
echo "Note: requested symlink from ${t} to ${s} on case-insensitive file system."; \ | |||||
fi | |||||
${INSTALL_SYMLINK} -S ${TAG_ARGS} ${s} ${DESTDIR}${t} | |||||
.else | |||||
${INSTALL_SYMLINK} ${TAG_ARGS} ${s} ${DESTDIR}${t} | ${INSTALL_SYMLINK} ${TAG_ARGS} ${s} ${DESTDIR}${t} | ||||
.endif | |||||
Not Done Inline ActionsWhy not here? bdrewery: Why not here? | |||||
Done Inline ActionsThis case didn't trigger errors, so I didn't notice. Fixed now. arichardson: This case didn't trigger errors, so I didn't notice. Fixed now. | |||||
.endfor | .endfor |
My first thought is 'why not include this always?'
I know Linux has a different -S flag, but all this is done using a bootstrapped installer. Wouldn't it be a lot simpler to just always use safe mode? Doesn't seem like it would be significantly slower and it would just work everywhere.