DragonFly BSD
DragonFly submit List (threaded) for 2005-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Making 'make upgrade' work from LiveCD, without sources


From: Chris Pressey <cpressey@xxxxxxxxxxxxxxx>
Date: Sat, 6 Aug 2005 15:44:36 -0700

Hi,

Per the conversation in users@ a while ago, attached is a patch which
allows 'make upgrade' to work without a src directory, i.e. from the
LiveCD.  It's still pretty rough, so consider it a first cut posted for
feedback.

- src/nrelease/Makefile installs a couple of extra things into /etc on
  the install image.  (Namely the Makefiles from src/etc, src/etc/isdn,
  src/etc/periodic, and the arch-specific etc subdir.)

- src/etc/Makefile is substantially modified, especially the upgrade_etc
  and preupgrade targets.  Two new make variables have been added:

    BINARY_UPGRADE - defined only when src is unavailable
    UPGRADE_SRCDIR - directory from which to get upgrade files
                     (defaults to .CURDIR)

  All of the places in upgrade_etc that used to refer to .CURDIR now
  refer to UPGRADE_SRCDIR instead, and many commands are conditional
  upon BINARY_UPGRADE.  The upgrade can be invoked from the LiveCD
  by:

    make -f /etc/Makefile                   \
         __MAKE_CONF=${BASE}/etc/make.conf  \
         BINARY_UPGRADE=YES                 \
         UPGRADE_SRCDIR=/etc/               \
         DESTDIR=${BASE}

  where ${BASE} is where the target system is mounted, generally /mnt.

A couple of the things that 'make upgrade' upgrades, like /dev and
/usr/share, can just be copied from the CD using 'cpdup', so the
commands to install them are skipped in the Makefile.

Upgrading /etc/mail using the Makefiles would be quite ugly/hackish, so
likewise I've left it outside the scope of this.  The files
etc/mail/helpfile, etc/mail/dragonfly.mc, and
etc/mail/dragonfly.submit.mc can be copied manually.  There seems to be
an existing problem here, though: etc/mail/README suggests that the
administrator alter the file dragonfly.submit.mc, directly, but 'make
upgrade' in src/etc/sendmail overwrites dragonfly.submit.mc.  This
suggests that something somewhere needs to be rethought, but since I've
never used sendmail, I couldn't say what that would be.

Comments?

-Chris


Index: etc/Makefile
===================================================================
RCS file: /servhome/dcvs/src/etc/Makefile,v
retrieving revision 1.82
diff -u -r1.82 Makefile
--- etc/Makefile	6 Aug 2005 11:36:13 -0000	1.82
+++ etc/Makefile	6 Aug 2005 19:19:36 -0000
@@ -14,9 +14,13 @@
 	rc rc.firewall6 \
 	rc.sendmail rc.shutdown \
 	rc.subr rpc services \
-	etc.${MACHINE_ARCH}/disktab \
-	${.CURDIR}/../usr.bin/mail/misc/mail.rc \
+	etc.${MACHINE_ARCH}/disktab
+.if defined(BINARY_UPGRADE) # Binary upgrade gets these from a diff place
+BINUPDATE+=mail.rc locate.rc
+.else
+BINUPDATE+=${.CURDIR}/../usr.bin/mail/misc/mail.rc \
 	${.CURDIR}/../usr.bin/locate/locate/locate.rc
+.endif
 
 # Initial distribution files are installed read-write (644)
 #
@@ -29,8 +33,12 @@
 	pf.conf phones printcap profile \
 	remote \
 	shells sysctl.conf syslog.conf usbd.conf \
-	etc.${MACHINE_ARCH}/ttys \
-	${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config
+	etc.${MACHINE_ARCH}/ttys
+.if defined(BINARY_UPGRADE) # Binary upgrade gets these from a diff place
+BIN1+=	manpath.config
+.else
+BIN1+=	${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config
+.endif
 
 .if exists(${.CURDIR}/../crypto) && !defined(NO_OPENSSL)
 .if !defined(NO_OPENSSH)
@@ -70,69 +78,88 @@
 # from /usr/lib.
 COMPAT_LIBS != cd ${DESTDIR}/usr/lib/compat; ls
 
+# Use this directory as the source for new configuration files when upgrading
+UPGRADE_SRCDIR?=${.CURDIR}
+
 distribute:
 	cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
 
 preupgrade:
 .if !defined(NO_SENDMAIL)
-	(pw groupshow smmsp -q > /dev/null) || \
-		pw groupadd smmsp -g 25
-	(pw usershow smmsp -q > /dev/null) || \
-		pw useradd smmsp -u 25 -c "Sendmail Submission User" \
+	(pw -V ${DESTDIR}/etc groupshow smmsp -q > /dev/null) || \
+		pw -V ${DESTDIR}/etc groupadd smmsp -g 25
+	(pw -V ${DESTDIR}/etc usershow smmsp -q > /dev/null) || \
+		pw -V ${DESTDIR}/etc useradd smmsp -u 25 \
+		   -c "Sendmail Submission User" \
 		   -d /var/spool/clientmqueue -s /sbin/nologin
 .endif
-	(pw usershow _pflogd -q > /dev/null) || \
-		pw useradd _pflogd -u 64 -c "pflogd privsep user" \
+	(pw -V ${DESTDIR}/etc usershow _pflogd -q > /dev/null) || \
+		pw -V ${DESTDIR}/etc useradd _pflogd -u 64 \
+		   -c "pflogd privsep user" \
 		   -d /var/empty -s /sbin/nologin
-	(pw usershow _ntp -q > /dev/null) || \
-		pw useradd _ntp -u 65 -c "ntpd privsep user" \
+	(pw -V ${DESTDIR}/etc usershow _ntp -q > /dev/null) || \
+		pw -V ${DESTDIR}/etc useradd _ntp -u 65 \
+		   -c "ntpd privsep user" \
 		   -d /var/empty -s /sbin/nologin
-	(pw groupshow authpf -q > /dev/null) || \
-		pw groupadd authpf -g 63
-	(pw groupshow _pflogd -q > /dev/null) || \
-		pw groupadd _pflogd -g 64
-	(pw groupshow _ntp -q > /dev/null) || \
-		pw groupadd _ntp -g 65
+	(pw -V ${DESTDIR}/etc groupshow authpf -q > /dev/null) || \
+		pw -V ${DESTDIR}/etc groupadd authpf -g 63
+	(pw -V ${DESTDIR}/etc groupshow _pflogd -q > /dev/null) || \
+		pw -V ${DESTDIR}/etc groupadd _pflogd -g 64
+	(pw -V ${DESTDIR}/etc groupshow _ntp -q > /dev/null) || \
+		pw -V ${DESTDIR}/etc groupadd _ntp -g 65
 
 upgrade_etc:	preupgrade
-	cd ${.CURDIR}/../share/mk; ${MAKE} install
-	cd ${.CURDIR}; \
+.if !defined(BINARY_UPGRADE) # already handled by binary upgrade
+	cd ${UPGRADE_SRCDIR}/../share/mk; ${MAKE} install
+.endif
+	cd ${UPGRADE_SRCDIR}; \
 	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
 		${BINUPDATE} ${DESTDIR}/etc; \
 	    cap_mkdb ${DESTDIR}/etc/login.conf; \
 	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
 		${BIN2} ${DESTDIR}/etc;
-	cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
+	cd ${UPGRADE_SRCDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
 	    ${DEFAULTS} ${DESTDIR}/etc/defaults
-	cd ${.CURDIR}/periodic; ${MAKE} install
-	cd ${.CURDIR}/rc.d; ${MAKE} install 
-	cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
-	cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
+	cd ${UPGRADE_SRCDIR}/periodic; ${MAKE} install
+	cd ${UPGRADE_SRCDIR}/rc.d; ${MAKE} install
+	# ../share/termcap/make etc-termap expanded inline here:
+	${LN} -fs ${BINDIR}/misc/termcap ${DESTDIR}/etc/termcap
+	# ../usr.sbin/rmt/make etc-rmt expanded inline here:
+	rm -f ${DESTDIR}/etc/rmt
+	${LN} -s ${BINDIR}/rmt ${DESTDIR}/etc/rmt
 .for pamconf in README convert.sh
 .if !exists(${DESTDIR}/etc/pam.d/${pamconf})
-	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/pam.d/${pamconf} ${DESTDIR}/etc/pam.d
+	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
+	    ${UPGRADE_SRCDIR}/pam.d/${pamconf} ${DESTDIR}/etc/pam.d
 .endif
 .endfor
+# XXX Binary upgrade currently handles this by copying all of /etc/mail
+.if !defined(BINARY_UPGRADE)
 .if !defined(NO_SENDMAIL)
-	cd ${.CURDIR}/sendmail; ${MAKE} upgrade
+	cd ${UPGRADE_SRCDIR}/sendmail; ${MAKE} upgrade
+.endif
 .endif
 .if !defined(NO_I4B)
-	cd ${.CURDIR}/isdn; ${MAKE} install
+	cd ${UPGRADE_SRCDIR}/isdn; ${MAKE} install
 .endif
+.if !defined(BINARY_UPGRADE) # already handled by binary upgrade
 .if !defined(NO_MAKEDEV)
-	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
+	cd ${UPGRADE_SRCDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
 	    MAKEDEV.local MAKEDEV ${DESTDIR}/dev
 .if !defined(NO_MAKEDEV_RUN)
 	cd ${DESTDIR}/dev; sh MAKEDEV all
 .endif
 .endif
-	cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
+.endif
+	cd ${UPGRADE_SRCDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
 	    ${MTREE} ${DESTDIR}/etc/mtree
-	cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
+.if !defined(BINARY_UPGRADE) # already handled by binary upgrade
+	cd ${UPGRADE_SRCDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
 	    ${FREEBSD} ${DESTDIR}/
 .if !defined(NOMAN)
 	cd ${.CURDIR}/../share/man; ${MAKE} makedb
 .endif
+.endif
 	rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
 	rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
 	${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
Index: nrelease/Makefile
===================================================================
RCS file: /servhome/dcvs/src/nrelease/Makefile,v
retrieving revision 1.39
diff -u -r1.39 Makefile
--- nrelease/Makefile	2 Aug 2005 17:57:14 -0000	1.39
+++ nrelease/Makefile	6 Aug 2005 18:27:16 -0000
@@ -160,6 +160,17 @@
 	rm -rf `find ${ISOROOT} -type d -name CVS -print`
 	rm -rf ${ISOROOT}/usr/local/share/pristine
 	pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
+.for UPGRADE_ITEM in Makefile			\
+		     etc.${MACHINE_ARCH} 	\
+		     isdn/Makefile		\
+		     rc.d/Makefile		\
+		     periodic/Makefile		\
+		     periodic/daily/Makefile	\
+		     periodic/security/Makefile	\
+		     periodic/weekly/Makefile	\
+		     periodic/monthly/Makefile
+	cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
+.endfor
 
 pkgcleaniso:
 	rm -f ${ISOROOT}/tmp/chrootscript




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]