README FOR updateyp 3.6 ----------------------- updateyp simplifies the process of managing source files for NIS maps that are under revision control. It automatically handles checkin and checkout of files, can rebuild and push the maps from anywhere on a master server (obviating the need to "cd /var/yp" before running the "make"), and if you know what you're looking for but not where it is, the "-g" option will find it. Why is it called "updateyp" and not "ypupdate"? History. It was partially based on a script called "updatedns", which was a front end for a software package called "updatehosts". INSTALLATION ------------ In the Makefile, set INST_DIR to wherever you want the software installed. You may also need to change the INSTALL command, depending on the location and version of "install" on your system. Then run "make install". updateyp makes use of several external programs, including sudo, vi, Perl, and RCS or SCCS. These should either be installed in some usual place (/usr/bin, /usr/local/bin), or you'll have to modify the PATH setting in the script. In addition, a usable "make" command must be in your own command path. USE --- The usual way to use updateyp is to call it with a list of map source filenames as arguments. updateyp will try to determine the location of each file, check it out for editing, open it up in an editor, let you review your changes after you're done, check it back into revision control, and then rebuild the maps and push them out to the slaves. For example: updateyp passwd passwd.adjunct hosts netgroups opens each map source file in turn, automatically taking care of checkin and checkout, and then builds and pushes the new maps. The tool is interactive, and gives you an option not to push the maps if you don't want to. If you just want to push the maps without using updateyp to make changes, use: updateyp none Another way to use it is by specifying a pattern to search for, instead of an explicit list of maps. For example: updateyp -g username opens each map source file that contains "username" in vi, and places the cursor at the first instance of "username"; you can get to additional instances with the usual vi search keys (like "n"). This is handy for deleting all references to a terminated account, a decommissioned host, etc. However, you should probably avoid using this if you keep map source files in /etc/ or some other general-use directory, as it works by performing a case-insensitive grep through all files in directories containing map sources. "updateyp -h" prints out a usage statement summarizing the above information. Some things you should be aware of: - updateyp assumes that the NIS Makefile is in /var/yp/. If that's not the case, change the "ypDir" variable in the script. - Set up revision control on the map source files before using updateyp. For example, if you use RCS, create an "RCS" directory in /var/yp/ (or wherever else you have source files), and do an initial check-in ("ci -i ...") on each file. - Make sure you have permissions to check out and edit the source files as yourself, because... - updateyp won't let you run as root. This is because... - updateyp makes use of external programs that can't be trusted. In particular, vi is the default editor, and the "-g" functionality is based on a vi feature. As vi lets you break out into a shell, updateyp assumes you're running as a non-root user, and makes use of sudo to run the make command that builds and pushes the maps. Oh yeah... - Make sure you have sudo privileges to run make. - If you use group write permissions to give people access to check out source files and edit them, you'll probably run into problems creating the mail aliases map. Upon generating the aliases database, a modern sendmail will complain about group-write permissions on a parent directory. There are a number of ways you might get around this; one is to add "-ODontBlameSendmail=GroupWritableDirPathSafe" to the sendmail command in /var/yp/Makefile. PLATFORMS --------- updateyp has been written for portability to most UNIX systems. It's been tested on the following platforms: - Linux - Red Hat Enterprise Linux 4 - Solaris - versions 2.5.1 through 8 CHANGES ------- You're not required by the license to submit changes back to the source, but I'd appreciate portability improvements or enhancements of general applicability. You can email new versions or contextual diffs ("diff -c old_file new_file") to . Some things to keep in mind if you do this: - Formatting - I use tabs for indentation, and sometimes to align code segments for readability. Please do the same. - Please don't use NotePad or some other Windows editor to make changes. Or if you do, get rid of the DOS linefeeds before submitting changes. - Please try to follow the formatting conventions established in the existing code. - Readability - Usually, I will trade off efficiency (of running time or of development time) in favor of readability. - Insert meaningful comments where appropriate. - Portability - All shell scripts are Bourne-compatible. I won't use shell- specific constructs from bash, ksh, etc. - Don't use OS-specific features, pathnames, etc., unless they're guarded by code checking the OS version, or they're in user-settable variables toward the top of the script. CONTRIBUTORS ------------ Leon Towns-von Stauber David Namiotka (help debugging password locking and shadow file support, Aug-Sep 1999) Ted Estes (fix for insufficient access to password lock) Enjoy! Copyright (c) 1997-2008. All rights reserved. See the LICENSE file distributed with this code for restrictions on its use and further distribution. Original distribution available at .