1N/A# install - installer for the DTraceToolkit 1N/A# This is a fairly simple script, most of it is error checking. 1N/A# All the script does is copy the DTraceToolkit files to another directory, 1N/A# with various checks. The user could have copied the files themselves, this 1N/A# script doesn't do anything special to them. It's really here in case 1N/A# people extrace the toolkit and go looking for an installer. 1N/A# 15-May-2005 Brendan Gregg Created this. 1N/A### Ensure we know where we are, 1N/Aprint "DTraceToolkit Installation\n---------------------------" 1N/Aprint "\nhit Ctrl-C any time you wish to quit.\n\n" 1N/Aprint -n
"Enter target directory for installation [/opt/DTT]: " 1N/A print "ERROR1: Location \"$loc\" is ambiguous.\n." 1N/A print ".\tTry a full path, like \"/opt/DTT\"\n." 1N/A print "ERROR2: Sorry, location \"$loc\" contains bad characters.\n." 1N/A### Process location, 1N/A### Check parent dir exists, 1N/A print "ERROR3: Parent directory \"$basename\" does not exist!\n." 1N/A print ".\tI'm not sure what you want me to do here, if you were" 1N/A print ".\tserious about the above parent directory - then run" 1N/A print ".\ta \"mkdir -p $basename\" first, then rerun this script.\n." 1N/A### Check parent dir perms, 1N/A print "ERROR4: Can't write to parent directory \"$basename\"!\n." 1N/A print ".\tSince I can't write to this directory, I can't install the" 1N/A print ".\tDTraceToolkit. You are currently logged in as,\n." 1N/A print ".\n.\tand the directory has permissions,\n." 1N/A print ".\n.\tMaybe you need to run \"su - $owner\" first?\n." 1N/A### Check if toolkit is already installed, 1N/A print "Warning: Possible old version of the DTraceToolkit found." 1N/A print "\tThis will DELETE the files in $loc, then install the toolkit." 1N/A print "\nWARNING: $loc doesn't look like an old DTraceToolkit!" 1N/A print -n
"\nContinue (will run \"rm -rf $loc\"). Are you sure (y/N)?: " 1N/A print "\nExiting..." 1N/A### Make new toolkit dir, 1N/Aprint "\nMaking directory \"$loc\"...\n" 1N/A print "ERROR6: Creation of \"$loc\" failed.\n." 1N/A print ".\tCheck directory location and try again.\n." 1N/A### Copy files across, 1N/Aprint "\nCopying DTraceToolkit files...\n" 1N/A print "ERROR7: Failure during copy.\n." 1N/A print ".\tCheck source \"$dir\" and destination \"$loc\", then" 1N/A print ".\ttry again.\n." 1N/A### Delete installer, 1N/Aprint "\nFinished.\n" 1N/Aprint "Installed to \"$loc\". See $loc/Guide for how to get started.\n"