
#Makefile for saving and restoring local files embedded in the system.  Makes 
#upgrading the operating system less painful, with fewer forgotten files.
#
#It is not intended that the restore be fully automated, but rather that the 
#names of the files remind the installer of what to do.  
#
#Note - you should run "make password" and then reinstall the old passwd file 
#before running "make restore" so that things are owned by the right uid.
#
#This particular Makefile.localsys is from a Sun 3.3 file server.
#

TAPE = /dev/rst0
TAR = tar
TAROPTIONS = cvf
RESTOREDIR = /usr/localsys

# These lists of files need to be modified to suit local conditions 
ROOT = {.profile,.emacs_pro,.login,.logout,.cshrc,.rhosts,.rootmenu,.defaults,Makefile.localsys}

PRIVATEUSR = {adm/acct,adm/aculog,adm/lastlog,adm/newsyslog,adm/savacct,adm/usracct,\
              adm/wtmp,lib/crontab,preserve,spool}

ETC = {hosts.equiv,remote,motd,servers,services,dumpdates,nd.local,syslog.conf,hosts,ethers, \
       netgroup,syslog.pid,exports,networks,ttys,ttytype,passwd,fstab,fstab.clients,printcap, \
       protocols,gettytab,group,rc,rc.boot,rc.local,rc.local.clients,rc.clients}

USRETC = {cohorts,termcap}

USRLIB = {Mail.rc,Mailrc,aliases,aliases.dir,aliases.pag,bmac,font/dev240,font/dev300,\
          font/devpsc,font/ft[RIBS],sendmail.cf,tmac/tmac.an,tmac/tmac.m}

SRCS = {new,sun,ucb}

USRSYS = {conf/ANCHOR,conf/BEERS,conf/ANCHOR.2swap}

USR = {local,new}

USRMAN = {manl}

# Type "make tape" to make a tape of all the local system files
tape: fake
	csh -c 'cd /; $(TAR) $(TAROPTIONS) - ./$(ROOT)  ./private/usr/$(PRIVATEUSR)\
        ./etc/$(ETC) ./usr/etc/$(USRETC) ./usr/lib/$(USRLIB) ./usr/src/$(SRCS)\
	./usr/man/$(USRMAN) ./usr/sys/$(USRSYS) | (cd /tools/anchor/localsys.bak; tar xf - )'


# Type "make localtape" to make a tape of all /usr/local and /usr/new 
localtape: fake
	csh -c 'cd /; $(TAR) $(TAROPTIONS) - ./usr/$(USR) | anchor dd of=$(TAPE)'
password: fake
	cd /$(RESTOREDIR); $(TAR) xf $(TAPE) ./etc/passwd
	csh -c 'echo "You need to install /$(RESTOREDIR)/etc/passwd"'

# Type "make restore" to restore from the tape.  Should make passwd first
restore: fake
	cd /$(RESTOREDIR); $(TAR) xf $(TAPE);


fake:
#	This makefile needs to be smart and needs to remind
#	humans, rather than automate everything, so changes 
#	in new releases will not be ignored or done wrong.
#
