cox (06/05/82)
Attached are the sources for a simple utility for packaging up arbitrary directories of ascii files for distribution over serial lines (like cu or uucp) such that they can be reconstructed at the receiving end with a 'universal dearchiver', the UNIX V7 shell. This was written to assist in file transfers between different flavors of UNIX, such as VAX to ONYX, ALTOS and Perkin-Elmer, etc, where one can't assume much about the capabilities of the receiving end except that it has a V7 shell. It also helps for moving files to non-UNIX systems, in that the 'control information' (various mkdir and tee commands) can be edited at the receiving end to drive their idea of a command interpreter. If other developers share my habit of maintaining every source program in its own directory area along with a collection of makefiles, test data, modification histories, etc, this utility encourages the habit of routinely distributing every file of possible relevance to an installer. The only things left behind are binaries... To install, put the following into someFile and run 'sh -x someFile' ---------------------------------------------------------------------- mkdir pk tee pk/Makefile >/dev/null <<'#EOF#' # pk Skeleton makefile LIB=/usr/itt/lib/cox.a INSTALL=$$HOME/bin PUTIT=-ln CC=cc CFLAGS=-g SRC=Makefile pk .SUFFIXES: .man .fmt .ms .me .mm .doc .y .l all: pk pk.fmt ; pk: $(OBJ) ; $(CC) $(OBJ) $(LIB) -o pk .man.fmt: ; nroff -man $< > $@ typeset: ; vgrind $(SRC); vtroff -man pk.man print: ; vpr $(SRC) install: all ; $(PUTIT) pk $(INSTALL) $(PUTIT) pk.man $(INSTALL)/.man $(PUTIT) pk.fmt $(INSTALL)/.fmt uninstall: ; rm -i $(INSTALL)/pk \ $(INSTALL)/.man/pk.man \ $(INSTALL)/.fmt/pk.fmt clean: ; rm -i *.o #EOF# tee pk/pk >/dev/null <<'#EOF#' for dir do echo "mkdir $dir"; for file in `file $dir/* | sed -n '/text$/s/:[^:]*$//p'` do echo "tee $file >/dev/null <<'#EOF#'" cat $file; echo "#EOF#" done pk `file $dir/* | sed -n '/directory$/s/:.*//p'` done #EOF# tee pk/pk.fmt >/dev/null <<'#EOF#' pk(1) UNIX Programmer's Manual pk(1) NAME pk - package directory (for export via cu or remote) SYNOPSIS pk directory ... DESCRIPTION When directories must be moved via cu or remote (or other means that don't allow a full 8 bit data path, which would allow the use of tar packaging), this program can help. It produces a shell script on stdout that includes mkdir commands to reconstruct the directory heirarchy and cat com- mands (with the body of files as shell 'here' documents) to move the files. Only ascii files and directories can be dealt with this way; pk uses file(1) to discard others. SEE ALSO file(1), cat(1), tar(1), sh(1), cat(1), cu(1), remote(1) BUGS AUTHOR Brad Cox, ITT Advanced Programming Technology, 1000 Oranoque Lane, Stratford, Ct 06497, Phone (203) 375 0200. Printed 10/25/81 1 #EOF# tee pk/pk.man >/dev/null <<'#EOF#' .TH pk 1 .SH NAME pk - package directory (for export via cu or remote) .SH SYNOPSIS pk directory ... .SH DESCRIPTION When directories must be moved via cu or remote (or other means that don't allow a full 8 bit data path, which would allow the use of tar packaging), this program can help. .PP It produces a shell script on stdout that includes mkdir commands to reconstruct the directory heirarchy and cat commands (with the body of files as shell 'here' documents) to move the files. .PP Only ascii files and directories can be dealt with this way; pk uses file(1) to discard others. .SH SEE ALSO file(1), cat(1), tar(1), sh(1), cat(1), cu(1), remote(1) .SH BUGS .SH AUTHOR Brad Cox, ITT Advanced Programming Technology, 1000 Oranoque Lane, Stratford, Ct 06497, Phone (203) 375 0200. #EOF#