To add an entry to the Makefile, do the following:
Add the name of the database to the all rule
Write the time rule
Add the rule for the database
For example, in order for the Makefile to work on automounter input files, you would have to add the auto_direct.time and auto_home.time maps to the NIS database.
To add these maps to the NIS database:
Modify the line that starts with the word all by adding the name(s) of the database you want to add:
all: passwd group hosts ethers networks rpc services protocols \ netgroup bootparams aliases netid netmasks \ auto_direct auto_home auto_direct.time auto_home.time |
The order of the entries is not relevant, but the blank space at the beginning of the continuation lines must be a Tab, not spaces.
Add the following lines at the end of the Makefile:
auto_direct: auto_direct.time auto_home: auto_home.time |
Add an entry for auto_direct.time in the middle of the file.
auto_direct.time: $(DIR)/auto_direct @(while read L; do echo $$L; done < $(DIR)/auto_direct $(CHKPIPE)) | \ (sed -e "/^#/d" -e "s/#.*$$//" -e "/^ *$$/d" $(CHKPIPE)) | \ $(MAKEDBM) - $(YPDBDIR)/$(DOM)/auto_direct; @touch auto_direct.time; @echo "updated auto_direct"; @if [ ! $(NOPUSH) ]; then $(YPPUSH) auto_direct; fi @if [ ! $(NOPUSH) ]; then echo "pushed auto_direct"; fi |
Where:
CHKPIPE makes certain that the operations to the left of the pipe (|) are successfully completed before piping the results to next commands. If the operations to the left of the pipe do not successfully complete, the process is terminated with a "NIS make terminated" message.
NOPUSH prevents the makefile from calling yppush to transfer the new map to the slave servers. If NOPUSH is not set, the push is done automatically.
The while loop at the beginning is designed to eliminate any backslash-extended lines in the input file. The sed script eliminates comment and empty lines, and feeds the output to
The same procedure should be followed for all other automounter maps such as auto_home, or any other nondefault maps.
# make name |
Where name is the name of the map you want to make. For example, auto_direct.