# /usr/src/etc/etc.mac2/newconfig/Makefile for MacMach

-include /usr/src/COPYRIGHTS

# note special case for /.hostname, /etc/fstab and /etc/hosts

ETC=	.rhosts rc.afs bootptab disktab ftpusers gettytab group	inetd.conf \
	rc.network networks passwd protocols rc rc.local remote resolv.conf \
	services syslog.conf termcap ttys
ROOT=	.cshrc .login .profile

all:	FRC
	@echo "Use \"make config\" to install new configuration files."
	@echo "Use \"make dev\" to make new device files."

dev:	FRC
	sh ${DESTDIR}/dev/MAKEDEV ${DESTDIR}/dev

# don't do "make install" from /etc/newconfig or /etc/oldconfig
install: FRC
	@[ `pwd` != "${DESTDIR}/etc/newconfig" ]
	@[ `pwd` != "${DESTDIR}/etc/oldconfig" ]
	rm -rf ${DESTDIR}/etc/oldconfig
	-mv ${DESTDIR}/etc/newconfig ${DESTDIR}/etc/oldconfig
	mkdir ${DESTDIR}/etc/newconfig
	find . -print | cpio -pduvm ${DESTDIR}/etc/newconfig
	echo "Configuration files installed `date`" >> ${DESTDIR}/etc/newconfig/README
	find ${DESTDIR}/etc/newconfig -exec chown root.bin {} \;
	find ${DESTDIR}/etc/newconfig -type d -exec chmod 555 {} \;
	find ${DESTDIR}/etc/newconfig -type f -exec chmod 444 {} \;

clean:	FRC

compress: clean
	find . -type f ! -name Makefile ! -name '*.Z' -exec compress {} \;

uncompress: FRC
	find . -type f ! -name Makefile -name '*.Z' -exec uncompress {} \;

# only do "make config" from /etc/newconfig
config:	FRC
	@[ `pwd` = "${DESTDIR}/etc/newconfig" ]
	@[ `pwd` != "${DESTDIR}/etc/oldconfig" ]
	install -c -o bin -g bin -m 444 ${ETC} ${DESTDIR}/etc
	install -c -o root -g wheel -m 444 ${ROOT} ${DESTDIR}/
	install -c -o root -g bin -m 444 MAKEDEV ${DESTDIR}/dev
	install -c -o games -g bin -m 444 dm.config ${DESTDIR}/usr/games
	echo "\"make config\" done `date`" >> README
	@echo ""
	@echo "New configuration files installed."
	-@if [ ! -r ${DESTDIR}/etc/fstab ]; then \
	  echo "WARNING: missing /etc/fstab"; \
	else \
	  echo "Using existing /etc/fstab"; \
	  cp ${DESTDIR}/etc/fstab fstab; \
	fi
	-@if [ ! -r ${DESTDIR}/etc/hosts ]; then \
	  echo "WARNING: missing /etc/hosts"; \
	else \
	  echo "Using existing /etc/hosts"; \
	  cp ${DESTDIR}/etc/hosts hosts; \
	fi
	-@if [ ! -r ${DESTDIR}/.hostname ]; then \
	  echo "WARNING: missing /.hostname"; \
	else \
	  echo "Using existing /.hostname"; \
	  cp ${DESTDIR}/.hostname .hostname; \
	fi

FRC:
