GenTran.sh

From radmind

Jump to: navigation, search

This is a very rough script. Use at your own risk.

This script will create and store a transcript for a single file which you specify as an argument to the script. This is handy for creating transcripts very quickly when a single file has been altered.

To use:

  1. Download GenTran.sh
  2. Make GenTran.sh executable
  3. Modify GenTran.sh with your radmind server information
  4. Modify a file on your system. This file is the one you will be checking into the radmind server.
  5. Set desired permissions
  6. Run GenTran.sh and specify the full path to the modified file as the first argument.
  7. eg : /path/to/GenTran.sh /path/to/file/to/checkin
#!/bin/sh
# 
# Origional Code from GenAppTran.sh : by Patrick McNeal
# 
# Copyright (c) 2007 Regents of The University of Michigan.
# All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appears in all copies and
# that both that copyright notice and this permission notice appear
# in supporting documentation, and that the name of The University
# of Michigan not be used in advertising or publicity pertaining to
# distribution of the software without specific, written prior
# permission. This software is supplied as is without expressed or
# implied warranties of any kind.
#
# Research Systems Unix Group
# The University of Michigan
# c/o Wesley Craig
# 4251 Plymouth Road B1F2, #2600
# Ann Arbor, MI 48105-2785
# radmind@umich.edu
# http://rsug.itd.umich.edu/software/radmind/
#
# GenTran.sh based upon GenAppTran.sh
# This is a script to quickly check in a single file to the radmind server.
# Modified By : Henri Shustak 2008
# Modified By : Henri Shustak 2009 - for any file / folder
#               Lucid Information Systems : http://www.lucidsystems.org
# Use this script with care - you must only use it for adding files
# This script can do damage you have been warned.
#


HOST=radmind.yourdomain.com
FSDIFF=/usr/local/bin/fsdiff
LCREATE=/usr/local/bin/lcreate
PING=/sbin/ping

$PING -q -c 1 $HOST > /dev/null 2>&1

if [ $? -ne 0 ]; then
	echo "Unable to find radmind server $HOST"
	exit 1
fi

UPLOAD="$1"

	TRANSCRIPT=`echo $UPLOAD | sed 's/[ ]//g'`
	TRANSCRIPT=`echo $TRANSCRIPT | sed 's/.app$/.T/'`
	
	echo ""
	echo "\tCreating transcript for $UPLOAD..."
	echo "\tPleae name this new transcript :"
	/bin/echo -n "        "
	read custom_transcript_name
	if [ "$custom_transcript_name" == "" ] ; then
       echo "\tNo transcript name provided."
       echo "\tTranscript creation canceled." 
	   exit 0
	else
	   TRANSCRIPT=$custom_transcript_name
    fi

    echo ""
	echo "\tEnter a comment for this transcript (press return for no comment):"
	/bin/echo -n "        "
	read transcript_comment
	if [ "$transcript_comment" != "" ] ; then
        echo "# $transcript_comment" > /tmp/$TRANSCRIPT
	else
        if [ -f /tmp/$TRANSCRIPT ] ; then 
            rm /tmp/$TRANSCRIPT
        fi
	fi
	
	echo ""
	echo "\tCreating transcript $TRANSCRIPT..."
	$FSDIFF -C -c sha1 -K /dev/null "$UPLOAD" | grep -v "/.DS_Store" >> /tmp/$TRANSCRIPT
	
	echo ""
	echo "\tTranscript stored at /tmp/$TRANSCRIPT"
	echo "\tView / Edit Transcript? [n/Y]"
	/bin/echo -n "        "
	read upload_transcript
	if [ "$upload_transcript" == "y" ] || [ "$upload_transcript" == "Y" ] || [ "$upload_transcript" == "yes" ] || [ "$upload_transcript" == "" ]; then
        open -a TextMate /tmp/$TRANSCRIPT
	fi

	
	echo ""
	echo "\tTranscript stored at /tmp/$TRANSCRIPT"
	echo "\tUpload transcript to server? [N/y]"
	/bin/echo -n "        "
	read upload_transcript
	if [ "$upload_transcript" != "y" ] && [ "$upload_transcript" != "Y" ] && [ "$upload_transcript" != "yes" ] ; then
        echo "\tTranscript upload cancled."
        echo "\tYou may still upload the transcript to the server manually." 
		exit 0
	fi

	
	echo "\tUploading $TRANSCRIPT..."
	$LCREATE -q -w 2 -h $HOST /tmp/$TRANSCRIPT
	echo "\tCleaning up $TRANSCRIPT..."
	rm /tmp/$TRANSCRIPT
	echo "Done."

exit 0

Personal tools