Ticket #28276: arb_macsetup.diff
File arb_macsetup.diff, 2.9 KB (added by matt.cottrell@…, 14 years ago) |
---|
-
arb_macsetup
old new 29 29 # 30 30 31 31 # This is the arb_macsetup script 32 # Use it to set the ARBHOME and PATH variables a fter 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. 33 33 34 34 # Derived from the MacPorts postflight script 35 35 # Provided by: Matthew Cottrell 36 # October 1, 200936 # January 31, 2011 37 37 38 38 # Abstraction variables: 39 39 # The MacPorts PREFIX is typicaly /opt/local … … 43 43 MANPAGES=${PREFIX}/share/man 44 44 TIMESTAMP=$(date +"%Y-%m-%d_at_%H:%M:%S") 45 45 BACKUP_SUFFIX=macports-saved_${TIMESTAMP} 46 XMODMAP_FILE=xmodmap 46 47 OUR_STRING="ARB Installer addition on ${TIMESTAMP}" 47 48 48 49 # Determine the user's shell, in order to choose an appropriate configuration file we'll be tweaking. … … 105 106 echo "An appropriate ${1} variable has been added to your shell environment by the ${3} installer." 106 107 } 107 108 109 function write_xmodmap_setting () { 110 if [ -f ${HOME}/.${XMODMAP_FILE} ] && ! grep "${OUR_STRING}" ${HOME}/.${XMODMAP_FILE} > /dev/null; then 111 echo "Backing up your ${HOME}/.${XMODMAP_FILE} keyboard confguration file as ${HOME}/.${XMODMAP_FILE}.${BACKUP_SUFFIX} before adapting it for ARB." 112 /bin/cp -fp ${HOME}/.${XMODMAP_FILE} "${HOME}/.${XMODMAP_FILE}.${BACKUP_SUFFIX}" || { 113 echo "An attempt to backup your original configuration file failed! Please set your ARB compatible environment manually." 114 115 exit 1 116 } 117 echo -e "\n##\n# Your previous ${HOME}/.${XMODMAP_FILE} file was backed up as ${HOME}/.${XMODMAP_FILE}.${BACKUP_SUFFIX}\n##" >> ${HOME}/.${XMODMAP_FILE} 118 fi 119 echo -e "\n# ${OUR_STRING}: adding an appropriate ${1} variable for use with ${3}." >> ${HOME}/.${XMODMAP_FILE} 120 echo "${1}\n ${2}\n ${3}\n ${4}\n ${5}\n ${6}\n ${7}\n" >> ${HOME}/.${XMODMAP_FILE} 121 echo -e "# Finished adapting your xmodmap file for use with ARB.\n" >> ${HOME}/.${XMODMAP_FILE} 122 chown ${USER} ${HOME}/.${XMODMAP_FILE} || echo "Warning: unable to adapt permissions on your ${HOME}/.${XMODMAP_FILE} shell configuration file!" 123 echo "An appropriate xmodmap file has been added to your home folder by the ${8} installer." 124 } 125 108 126 # Confirm that MacPorts has been configured for this user: 109 127 if ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/printenv PATH" | grep ${PREFIX} > /dev/null; then 110 128 echo "Your shell already has the right PATH environment variable for use with MacPorts!" … … 149 167 write_setting ARBHOME "${PREFIX}/share/arb" ARB 150 168 fi 151 169 170 #write the .xmodmap file for easy keyboard shortcutsin the ARB sequence editor 171 write_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 172 152 173 # arb_setenv script is done with its job - exit gracefully! 153 174 echo "" 154 175 echo "You have succesfully installed ARB"