From 93590f0d52894af8ccef375fd290b04eaa83b5f0 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 21:33:50 -0400 Subject: Implement fakehome --- install | 72 ++++++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/install b/install index c1750049..b8f29a91 100755 --- a/install +++ b/install @@ -24,6 +24,7 @@ # -i, --imdir # set image directory # -m, --mach # set architecture # -r, --root # set iraf root directory +# -f, --fakehome # set the non-home directory (think /home/user/.iraf) # # -C, --oldcache # set old cache directory # -I, --oldimdir # set old image directory @@ -122,6 +123,7 @@ install_help() { ECHO " -i, --imdir # set image directory" ECHO " -m, --mach # set architecture" ECHO " -r, --root # set iraf root directory" + ECHO " -f, --fakehome # set the non-home directory (think /home/user/.iraf)" ECHO "" ECHO " -C, --oldcache # set old cache directory" ECHO " -I, --oldimdir # set old image directory" @@ -194,6 +196,9 @@ while [ -n "$1" ] ; do fi ;; + "-f"|"-fakehome"|"--fakehome") # set the non-home directory + o_fakehome=$2; shift + ;; "-C"|"-oldcache"|"--oldcache") # set old cache directory o_cache=$2 ; shift ;; @@ -244,12 +249,15 @@ if [ "$o_cache" == "" ]; then fi o_cache=`echo $o_cache | sed -e 's+/\(["]*\)$+\1+'` - +#if [ "$o_fakehome" == "" ]; then +# o_fakehome=`grep "^fakehome=" $mkiraf | sed -e "s+fakehome=++" -e 's+"++g'` +#fi +#o_fakehome=`echo $o_fakehome| sed -e 's+/\(["]*\)$+\1+'` #============================================================================= # User Check # -# If we're doing a private install, initialize the $HOME/.iraf directory. +# If we're doing a private install, initialize the ${FAKEHOME} directory. #============================================================================= # Get the current user name. @@ -307,15 +315,15 @@ if [ "$WHOAMI" == "root" ]; then fi if (( $do_system==0 )); then - if [ ! -e "$HOME/.iraf" ]; then + if [ ! -e "${FAKEHOME}" ]; then NEWLINE - ECHO "Initializing $HOME/.iraf directory ....." + ECHO "Initializing ${FAKEHOME} directory ....." NEWLINE - mkdir $HOME/.iraf - (cd $HOME/.iraf ; mkdir imdir cache bin) + mkdir ${FAKEHOME} + (cd ${FAKEHOME} ; mkdir imdir cache bin) fi - bindir="$HOME/.iraf/bin" + bindir="${FAKEHOME}/bin" fi @@ -462,7 +470,7 @@ done if [ "$imdir" == "" ]; then if (( $do_system==0 )); then - d_imdir="$HOME/.iraf/imdir/" + d_imdir="${FAKEHOME}/imdir/" elif [ -d "$o_imdir" ]; then d_imdir=$o_imdir elif [ -d "/iraf" ]; then @@ -528,7 +536,7 @@ fi if [ "$cache" == "" ]; then if (( $do_system==0 )); then - d_cache="$HOME/.iraf/cache/" + d_cache="${FAKEHOME}/cache/" elif [ -d "/iraf" ]; then d_cache="/iraf/cache" elif [ -d "/home/iraf" ]; then @@ -592,7 +600,7 @@ fi if [ "$lbin" == "" ]; then # Look around and come up with a likely candidate directory. if (( $do_system==0 )); then - d_lbin="$HOME/.iraf/bin/" + d_lbin="${FAKEHOME}/bin/" elif [ -d "/usr/local/bin" ]; then d_lbin="/usr/local/bin" elif [ -d "/opt/local/bin" ]; then @@ -1121,7 +1129,7 @@ fi if (( "do_system"==1 )); then ECHO -n "Creating root imdir at $imdir ... " else - ECHO -n 'Creating root imdir at $HOME/.iraf/imdir ... ' + ECHO -n 'Creating root imdir at ${FAKEHOME}/imdir ... ' ECHO -n ' ' fi if [ "$exec" == "yes" ]; then @@ -1150,7 +1158,7 @@ fi if (( "do_system"==1 )); then ECHO -n "Creating root cache at $cache ... " else - ECHO -n 'Creating root cache at $HOME/.iraf/cach ... ' + ECHO -n 'Creating root cache at ${FAKEHOME}/cach ... ' ECHO -n ' ' fi if [ "$exec" == "yes" ]; then @@ -1252,7 +1260,7 @@ if (( "$do_system"==1 )); then else # else of 'do_system' ECHO -n "Creating symlink ... " - file1="$HOME/.iraf/iraf.h" + file1="${FAKEHOME}/iraf.h" file2="$iraf/unix/hlib/libc/iraf.h" err_seen=0 @@ -1280,10 +1288,10 @@ else # else of 'do_system' ECHO -n 'Marking system architecture ... ' if [ "$exec" == "yes" ]; then - if [ -e "$HOME/.iraf/arch" ]; then - RM $HOME/.iraf/arch + if [ -e "${FAKEHOME}/arch" ]; then + RM ${FAKEHOME}/arch fi - echo $IRAFARCH > $HOME/.iraf/arch + echo $IRAFARCH > ${FAKEHOME}/arch fi DO_OK @@ -1534,10 +1542,10 @@ if (( "$do_system"==0 )); then for f in ${xfiles[@]}; do if [ -e "$iraf/vendor/x11iraf/bin.$IRAFARCH/$f" ]; then if [ "$exec" == "yes" ]; then - if [ -e "$HOME/.iraf/bin/$f" ]; then - RM $HOME/.iraf/bin/$f + if [ -e "${FAKEHOME}/bin/$f" ]; then + RM ${FAKEHOME}/bin/$f fi - ln -s $iraf/vendor/x11iraf/bin.$IRAFARCH/$f $HOME/.iraf/bin/$f + ln -s $iraf/vendor/x11iraf/bin.$IRAFARCH/$f ${FAKEHOME}/bin/$f fi fi done @@ -1557,13 +1565,13 @@ if [ "$do_system" == 0 ]; then BOLD_OFF cur=$PWD - if [ ! -e $HOME/.iraf ]; then - mkdir $HOME/.iraf + if [ ! -e ${FAKEHOME} ]; then + mkdir ${FAKEHOME} fi - cd $HOME/.iraf + cd ${FAKEHOME} ECHO -n "Creating global login.cl and uparm directory .... " $iraf/unix/hlib/mkiraf.sh --default --init --term=$myterm >& /dev/null - if [ -e "$HOME/.iraf/login.cl" ]; then + if [ -e "${FAKEHOME}/login.cl" ]; then DO_OK else DO_FAIL @@ -1585,8 +1593,8 @@ if [ "$do_system" == 0 ]; then if (( $?==1 )); then echo "" >> $TEMP echo "# Add iraf setup commands" >> $TEMP - echo "if ( -e $HOME/.iraf/setup.csh ) then" >> $TEMP - echo " source $HOME/.iraf/setup.csh" >> $TEMP + echo "if ( -e ${FAKEHOME}/setup.csh ) then" >> $TEMP + echo " source ${FAKEHOME}/setup.csh" >> $TEMP echo "endif" >> $TEMP cp $file ${file}.bak PUT $TEMP $file @@ -1597,8 +1605,8 @@ if [ "$do_system" == 0 ]; then RM -f $TEMP >& /dev/null echo "" > $file echo "# Add iraf setup commands" >> $file - echo "if ( -e $HOME/.iraf/setup.csh ) then" >> $file - echo " source $HOME/.iraf/setup.csh" >> $file + echo "if ( -e ${FAKEHOME}/setup.csh ) then" >> $file + echo " source ${FAKEHOME}/setup.csh" >> $file echo "endif" >> $file fi done @@ -1613,8 +1621,8 @@ if [ "$do_system" == 0 ]; then if (( $?==1 )); then echo "" >> $TEMP echo "# Add iraf setup commands" >> $TEMP - echo "if [ -e $HOME/.iraf/setup.sh ]; then" >> $TEMP - echo " source $HOME/.iraf/setup.sh" >> $TEMP + echo "if [ -e ${FAKEHOME}/setup.sh ]; then" >> $TEMP + echo " source ${FAKEHOME}/setup.sh" >> $TEMP echo "fi" >> $TEMP cp $file ${file}.bak PUT $TEMP $file @@ -1625,8 +1633,8 @@ if [ "$do_system" == 0 ]; then RM -f $TEMP >& /dev/null echo "" > $file echo "# Add iraf setup commands" >> $file - echo "if [ -e $HOME/.iraf/setup.sh ]; then" >> $file - echo " source $HOME/.iraf/setup.sh" >> $file + echo "if [ -e ${FAKEHOME}/setup.sh ]; then" >> $file + echo " source ${FAKEHOME}/setup.sh" >> $file echo "fi" >> $file fi done @@ -1678,7 +1686,7 @@ if (( "$err_count"==0 )); then BOLD_ON; ECHO 'cl '; BOLD_OFF ECHO "" ECHO "From any directory to use the global login files created in the" - BOLD_ON ; ECHO -n "$HOME/.iraf " ; BOLD_OFF + BOLD_ON ; ECHO -n "${FAKEHOME} " ; BOLD_OFF ECHO "directory. If you wish to have a login.cl/uparm that" ECHO "is specific to a particular directory, you will need to type" ECHO "" -- cgit