Ticket #28276: arb_macsetup.3.diff

File arb_macsetup.3.diff, 3.5 KB (added by matt.cottrell@…, 14 years ago)

Corrects capitalization of PREFIX

  • arb_macsetup

    old new  
    2929#
    3030
    3131# This is the arb_macsetup script
    32 # Use it to set the ARBHOME and PATH variables after installing ARB using MacPorts.
     32# Use it to set the ARBHOME and PATH variables and to install a .xmodmap file after installing ARB using MacPorts.
    3333
    3434# Derived from the MacPorts postflight script
    3535# Provided by: Matthew Cottrell
    36 # October 1, 2009
     36# January 31, 2011
    3737
    3838# Abstraction variables:
    3939PREFIX=@@PREFIX@@
     
    4242MANPAGES=${PREFIX}/share/man
    4343TIMESTAMP=$(date +"%Y-%m-%d_at_%H:%M:%S")
    4444BACKUP_SUFFIX=macports-saved_${TIMESTAMP}
     45XMODMAP_FILE=xmodmap
    4546OUR_STRING="ARB Installer addition on ${TIMESTAMP}"
    4647
    4748# Determine the user's shell, in order to choose an appropriate configuration file we'll be tweaking.
     
    104105    echo "An appropriate ${1} variable has been added to your shell environment by the ${3} installer."
    105106}
    106107
     108function write_xmodmap_setting () {
     109    if [ -f ${HOME}/.${XMODMAP_FILE} ] && ! grep "${OUR_STRING}" ${HOME}/.${XMODMAP_FILE} > /dev/null; then
     110        echo "Backing up your ${HOME}/.${XMODMAP_FILE} keyboard confguration file as ${HOME}/.${XMODMAP_FILE}.${BACKUP_SUFFIX} before adapting it for ARB."
     111        /bin/cp -fp ${HOME}/.${XMODMAP_FILE} "${HOME}/.${XMODMAP_FILE}.${BACKUP_SUFFIX}" || {
     112            echo "An attempt to backup your original configuration file failed! Please set your ARB compatible environment manually."
     113           
     114            exit 1
     115        }
     116        echo -e "\n##\n# Your previous ${HOME}/.${XMODMAP_FILE} file was backed up as ${HOME}/.${XMODMAP_FILE}.${BACKUP_SUFFIX}\n##" >> ${HOME}/.${XMODMAP_FILE}
     117    fi
     118    echo -e "${1}\n${2}\n${3}\n${4}\n${5}\n${6}\n${7}\n" > ${HOME}/.${XMODMAP_FILE}
     119    chown ${USER} ${HOME}/.${XMODMAP_FILE} || echo "Warning: unable to adapt permissions on your ${HOME}/.${XMODMAP_FILE} shell configuration file!"
     120    echo "An appropriate xmodmap file has been added to your home folder by the ${8} installer."
     121}
     122
    107123# Confirm that MacPorts has been configured for this user:
    108124if ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/printenv PATH" | grep ${PREFIX} > /dev/null; then
    109125    echo "Your shell already has the right PATH environment variable for use with MacPorts!"
     
    148164        write_setting ARBHOME "${PREFIX}/share/arb" ARB
    149165fi
    150166
     167#write the .xmodmap file for easy keyboard shortcutsin the ARB sequence editor
     168write_xmodmap_setting "clear Mod1" "clear Mod2" "keycode 63 = Mode_switch" "keycode 66 = Meta_L" "keycode 69 = Meta_R" "add Mod1 = Meta_L Meta_R" "add Mod2 = Mode_switch" ARB
     169
    151170# arb_setenv script is done with its job - exit gracefully!
    152171echo ""
    153172echo "You have succesfully installed ARB"
    154173echo ""
    155174echo  "Open a new terminal window and type arb to launch ARB"
    156175echo ""
    157 echo "A demo data base is located at ${prefix}/share/arb.demo.arb"
     176echo "A demo data base is located at ${PREFIX}/share/arb.demo.arb"
    158177echo ""
    159178echo "************************************************************************************************"
    160 echo "Note: To set up ARB for another user log into their account and type ${prefix}/bin/arb_macsetup"
     179echo "Note: To set up ARB for another user log into their account and type ${PREFIX}/bin/arb_macsetup"
    161180echo "************************************************************************************************"
    162181echo ""
    163182echo "Please cite: Wolfgang Ludwig, et al. (2004) ARB: a software environment for sequence data. Nucleic Acids Research. 32:1363-1371"