Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!decwrl!bacchus.pa.dec.com!mogul From: mogul@wrl.dec.com (Jeffrey Mogul) Newsgroups: comp.unix.ultrix Subject: Re: vms/cms -> ultrix/rcs Message-ID: <1990Oct16.010838.24632@wrl.dec.com> Date: 16 Oct 90 01:08:38 GMT References: Sender: news@wrl.dec.com (News) Organization: DEC Western Research Lines: 118 In article braun@dri.com (Karl T. Braun (kral)) writes: >Currently one of the engineers has a wieldy and fragile set of csh/sh and dcl >scripts running which > (1) check out a file from cms, old revision > (2) move it (via dcp) to the ultrix machine > (3) ci it into the rcs system. >This must be done one revision at a time for each file. Can you say *BARFO*? >Anyone got any better ideas (boy, I sure hope so!)? The usual unix-to-unix solution to this kind of problem is called "shar", which stands for "shell archive". The basic idea is that you write a shell script that contains a set of text files as "data", interspersed with shell commands that unpack this data into the proper files. Or rather, you don't actually write this script, you run a simple program that creates the script (on the source machine). You then copy the script, as one file, to the target machine, and then invoke it as a shell script, whereupon it unpacks itself. Perhaps someone out there has a "shar" generator written in DCL. Otherwise, you'll have to write your own. (I was writing DCL scripts before most people had even heard of VMS; but since I haven't written any since then, I can't help you with this.) The original versions of "shar" were written as shell scripts themselves, although nowadays they are written in C. I've appended a version written for the shell (note that I've included it as a "shar" archive, albeit one created with a fancier version of "shar"). In your case, since you have a specific task that includes not just moving the files, but using CMS and RCS, you might find it easier to write a special-purpose DCL script that takes a list of files, checks them out from CMS, and creates a shell script containing the files interspersed with shell commands that unpack the files and "ci" them. -Jeff #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'shar.sh' <<'END_OF_FILE' X#!/bin/sh - X# X# Copyright (c) 1990 The Regents of the University of California. X# All rights reserved. X# X# Redistribution and use in source and binary forms are permitted X# provided that: (1) source distributions retain this entire copyright X# notice and comment, and (2) distributions including binaries display X# the following acknowledgement: ``This product includes software X# developed by the University of California, Berkeley and its contributors'' X# in the documentation or other materials provided with the distribution X# and in all advertising materials mentioning features or use of this X# software. Neither the name of the University nor the names of its X# contributors may be used to endorse or promote products derived X# from this software without specific prior written permission. X# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR X# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED X# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. X# X# @(#)shar.sh 5.2 (Berkeley) 5/23/90 X# X if [ $# -eq 0 ]; then X echo 'usage: shar file ...' X exit 1 fi X cat << EOF X# This is a shell archive. Save it in a file, remove anything before X# this line, and then unpack it by entering "sh file". Note, it may X# create directories; files and directories will be owned by you and X# have default permissions. X# X# This archive contains: X# XEOF X for i do X echo "# $i" done X echo "#" X for i do X if [ -d $i ]; then X echo "echo c - $i" X echo "mkdir $i > /dev/null 2>&1" X else X echo "echo x - $i" X echo "sed 's/^X//' >$i << 'END-of-$i'" X sed 's/^/X/' $i X echo "END-of-$i" X fi done echo exit echo "" X exit 0 END_OF_FILE if test 1647 -ne `wc -c <'shar.sh'`; then echo shar: \"'shar.sh'\" unpacked with wrong size! fi # end of 'shar.sh' fi echo shar: End of shell archive. exit 0