summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorjdp <jdp@FreeBSD.org>2000-07-08 03:27:54 +0000
committerjdp <jdp@FreeBSD.org>2000-07-08 03:27:54 +0000
commitaa26657bfbbf4260f14797da8a632778e067951e (patch)
treec5705e7cd1f89a09cb78d472835342f4f49c710e /libexec
parent92dfcced5b1f09d53134a113742dd41d79195190 (diff)
downloadFreeBSD-src-aa26657bfbbf4260f14797da8a632778e067951e.zip
FreeBSD-src-aa26657bfbbf4260f14797da8a632778e067951e.tar.gz
When installing the dynamic linker, save the previous version in
"ld-elf.so.1.old". The dynamic linker is a critical component of the system, and it is difficult to recover if it is damaged and there isn't a working backup available. For instance, parts of the toolchain such as the assembler are dynamically linked, making it impossible to build a new dynamic linker if the installed one doesn't work.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/Makefile12
1 files changed, 12 insertions, 0 deletions
diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile
index db8955e..e3750cc 100644
--- a/libexec/rtld-elf/Makefile
+++ b/libexec/rtld-elf/Makefile
@@ -42,3 +42,15 @@ dyn_hack.so:
.PATH: ${.CURDIR}/${MACHINE_ARCH}
.include <bsd.prog.mk>
+
+# Keep the previous version of the dynamic linker for recovery
+# purposes. This must come after the include of <bsd.prog.mk> so that
+# BINDIR is set for the exists(...) constructs.
+beforeinstall:
+.if exists(${DESTDIR}${BINDIR}/${PROG})
+ -chflags noschg ${DESTDIR}${BINDIR}/${PROG}
+.if exists(${DESTDIR}${BINDIR}/${PROG}.old)
+ -chflags noschg ${DESTDIR}${BINDIR}/${PROG}.old
+.endif
+ cp -p ${DESTDIR}${BINDIR}/${PROG} ${DESTDIR}${BINDIR}/${PROG}.old
+.endif
OpenPOWER on IntegriCloud