| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function prepare_doLinks { |
| |
| |
| if [[ $FLAG_LINKS == 'false' ]];then |
| return |
| fi |
| |
| local -a LINKS_SRC |
| local -a LINKS_DST |
| local SUFFIX='' |
| local USERFILES='' |
| local PALETTE='' |
| local BRUSH='' |
| local PATTERN='' |
| local FONT='' |
| local FILE='' |
| local COUNT=0 |
| |
| |
| local GIMP_USERDIR=${HOME}/.$(rpm -q gimp | cut -d. -f-2) |
| local INKS_USERDIR=${HOME}/.inkscape |
| |
| |
| LINKS_SRC[((++${#LINKS_SRC[*]}))]=${HOME}/bin/$CLI_PROGRAM |
| LINKS_DST[((++${#LINKS_DST[*]}))]=${CLI_BASEDIR}/${CLI_PROGRAM}.sh |
| USERFILES="${HOME}/bin/$CLI_PROGRAM" |
| |
| |
| for FONT in $(cli_getFilesList ${HOME}/artwork/trunk/Identity/Fonts --pattern='denmark\.ttf');do |
| LINKS_SRC[((++${#LINKS_SRC[*]}))]=${HOME}/.fonts/$(basename $FONT) |
| LINKS_DST[((++${#LINKS_DST[*]}))]=$FONT |
| done |
| |
| |
| for PALETTE in $(cli_getFilesList ${HOME}/artwork/trunk/Identity/Palettes --pattern=".+\.gpl");do |
| SUFFIX="${GIMP_USERDIR}/palettes/$(prepare_doLinksSuffixes $PALETTE)" |
| LINKS_SRC[((++${#LINKS_SRC[*]}))]=${SUFFIX}${NAME}${VERS}$(basename $PALETTE) |
| LINKS_DST[((++${#LINKS_DST[*]}))]=$PALETTE |
| SUFFIX="${INKS_USERDIR}/palettes/$(prepare_doLinksSuffixes $PALETTE)" |
| LINKS_SRC[((++${#LINKS_SRC[*]}))]=${SUFFIX}${NAME}${VERS}$(basename $PALETTE) |
| LINKS_DST[((++${#LINKS_DST[*]}))]=$PALETTE |
| done |
| |
| |
| for BRUSH in $(cli_getFilesList ${HOME}/artwork/trunk/Identity/Brushes --pattern=".+\.(gbr|gih)");do |
| SUFFIX="${GIMP_USERDIR}/brushes/$(prepare_doLinksSuffixes $BRUSH)" |
| LINKS_SRC[((++${#LINKS_SRC[*]}))]=${SUFFIX}${NAME}${VERS}$(basename $BRUSH) |
| LINKS_DST[((++${#LINKS_DST[*]}))]=$BRUSH |
| done |
| |
| |
| for PATTERN in $(cli_getFilesList ${HOME}/artwork/trunk/Identity/Patterns --pattern=".+\.png");do |
| SUFFIX="${GIMP_USERDIR}/patterns/$(prepare_doLinksSuffixes $PATTERN)" |
| LINKS_SRC[((++${#LINKS_SRC[*]}))]=${SUFFIX}${NAME}${VERS}$(basename $PATTERN) |
| LINKS_DST[((++${#LINKS_DST[*]}))]=$PATTERN |
| done |
| |
| |
| if [[ $EDITOR == '/usr/bin/vim' ]];then |
| LINKS_SRC[((++${#LINKS_SRC[*]}))]=${HOME}/.vimrc |
| LINKS_DST[((++${#LINKS_DST[*]}))]=${FUNCCONFIG}/vimrc |
| USERFILES="${USERFILES} ${HOME}/.vimrc" |
| fi |
| |
| |
| |
| |
| |
| USERFILES=$(echo "$USERFILES"; |
| cli_getFilesList ${HOME}/bin --pattern='.+\.sh'; |
| cli_getFilesList ${HOME}/.fonts --pattern='.+\.ttf'; |
| cli_getFilesList ${GIMP_USERDIR}/brushes --pattern='.+\.(gbr|gih)'; |
| cli_getFilesList ${GIMP_USERDIR}/patterns --pattern='.+\.(pat|png|jpg|bmp)'; |
| cli_getFilesList ${GIMP_USERDIR}/palettes --pattern='.+\.gpl'; |
| cli_getFilesList ${INKS_USERDIR}/palettes --pattern='.+\.gpl';) |
| |
| |
| if [[ "$USERFILES" != '' ]];then |
| cli_printActionPreamble $USERFILES --to-delete |
| rm -r $USERFILES |
| fi |
| |
| |
| cli_printActionPreamble ${LINKS_SRC[*]} --to-create |
| |
| while [[ $COUNT -lt ${#LINKS_SRC[*]} ]];do |
| |
| |
| if [[ -a ${LINKS_SRC[$COUNT]} ]];then |
| cli_printMessage "${LINKS_SRC[$COUNT]}" --as-updating-line |
| else |
| cli_printMessage "${LINKS_SRC[$COUNT]}" --as-creating-line |
| fi |
| |
| |
| if [[ ! -d $(dirname ${LINKS_SRC[$COUNT]}) ]];then |
| mkdir -p $(dirname ${LINKS_SRC[$COUNT]}) |
| fi |
| |
| |
| ln ${LINKS_DST[$COUNT]} ${LINKS_SRC[$COUNT]} --symbolic --force |
| |
| |
| COUNT=$(($COUNT + 1)) |
| |
| done |
| |
| } |