Differences
This shows you the differences between two versions of the page.
— |
help:sysnews:isohome.script [2008/05/06 22:42] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== isohome ====== | ||
+ | Isohome is a simple script that tries to make an image of your CS home directory that is suitable for burning onto a CD or DVD. | ||
+ | |||
+ | It will confirm that you are running it from the machine where your home directory is actually a local disk. If not it will tell you which machine you need to run the script from. | ||
+ | |||
+ | So, bring a blank CD into the lab and give it a go. | ||
+ | |||
+ | For the curious, here is the script. | ||
+ | |||
+ | -Greg | ||
+ | |||
+ | < | ||
+ | # | ||
+ | # | ||
+ | # isohome: a script to make an iso image of a users home | ||
+ | # directory in a users home directory by Greg Priest-Dorman | ||
+ | # | ||
+ | # $Id: isohome,v 1.7 2004/05/15 06:42:11 priestdo Exp $ | ||
+ | # | ||
+ | IFS=" | ||
+ | " | ||
+ | ECHO=/ | ||
+ | MKISOFS=/ | ||
+ | BKUPNAME=$HOME/ | ||
+ | DU=/ | ||
+ | MAIL=/ | ||
+ | DF=/ | ||
+ | AWK=/ | ||
+ | # | ||
+ | # Get the name of the system that the users home directory lives on from the nis auto.home map | ||
+ | # | ||
+ | HomeHost=`ypcat -k auto.home|grep $USER|$AWK '{ print $2 }'|cut -f1 -d:` | ||
+ | # | ||
+ | if [ $HOST == $HomeHost ] ; then | ||
+ | $ECHO "\n Checking available space...\n" | ||
+ | HomeUsed=`$DU -sk $HOME |$AWK '{ print int(($1 | ||
+ | HomeFree=`$DF -k|grep $HOME | $AWK '{ print int(($3 / 1024) + -99.5)}' | ||
+ | if [ ${HomeUsed} -lt ${HomeFree} ] ; then | ||
+ | $ECHO "\n There is enough free space to create the backup image.\n" | ||
+ | MEDIA="" | ||
+ | if [ ${HomeUsed} -lt 650 ] ; then | ||
+ | $ECHO " Your backup image will fit on a single CD\n" | ||
+ | MEDIA=" | ||
+ | else | ||
+ | if [ ${HomeUsed} -lt 4000 ] ; then | ||
+ | $ECHO " Your backup image may not fit on a single CD, but will fit on a DVD.\n" | ||
+ | MEDIA=" | ||
+ | fi | ||
+ | fi | ||
+ | if [ ${MEDIA} != "" | ||
+ | $ECHO " It will use around $HomeUsed Meg.\n" | ||
+ | $ECHO " If you choose to proceed an iso9660 image of your home directory" | ||
+ | $ECHO " will be created and a log message will be sent to Greg. Once" | ||
+ | $ECHO " complete you will have to copy the backup image to a machine" | ||
+ | $ECHO " that has a $MEDIA burner in order to make your $MEDIA.\n" | ||
+ | $ECHO " Please remove your image from the suns once you" | ||
+ | $ECHO " have burned your $MEDIA. | ||
+ | $ECHO " remove it, it will be removed once it is more than" | ||
+ | $ECHO " a day old.\n" | ||
+ | $ECHO " The image will skip anything ending in" | ||
+ | $ECHO ' " | ||
+ | $ECHO ' " | ||
+ | $ECHO "Do you wish to proceed? (y/ | ||
+ | read YN | ||
+ | case $YN in | ||
+ | y|Y|yes|Yes|YES|yep) | ||
+ | $ECHO " | ||
+ | for FOUND in `find $HOME -print |egrep | ||
+ | do | ||
+ | $ECHO " | ||
+ | done | ||
+ | # | ||
+ | # options to mkisofs explained: | ||
+ | # -J Joliet directory records in addition to iso9660 file names | ||
+ | # -x exclude pattern(seems to like ' | ||
+ | # -m exclude glob | ||
+ | # -r generates additional Rock Ridge protocol records with intelligent uid and gid | ||
+ | # -T Generate a TRANS.TBL in each directory for use in non-Rock Ridge system | ||
+ | # -o output file name | ||
+ | # | ||
+ | # put all togethe and you get a cd that should be readable on a very wide varity of systems | ||
+ | # HOWEVER, | ||
+ | # and gid - see man page | ||
+ | # | ||
+ | |||
+ | $MKISOFS | ||
+ | ;; | ||
+ | *) | ||
+ | $ECHO "\n If thats the way you feel about it...\n ... script aborting" | ||
+ | ;; | ||
+ | esac | ||
+ | fi | ||
+ | else | ||
+ | $ECHO "\n There is not enough free space in your home directory" | ||
+ | $ECHO " to do the backup. | ||
+ | $ECHO "... script aborting\n" | ||
+ | fi | ||
+ | # | ||
+ | else | ||
+ | $ECHO "\n You need to run $0 from ${HomeHost}. " | ||
+ | $ECHO " When this script exits issue the command: \n" | ||
+ | $ECHO " | ||
+ | $ECHO "... script aborting\n" | ||
+ | fi | ||
+ | </ |