| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function prepare_doLinks { |
| |
| |
| if [[ $FLAG_LINKS == 'false' ]];then |
| return |
| fi |
| |
| |
| cli_printMessage '-' 'AsSeparatorLine' |
| |
| |
| cli_printMessage "`gettext "Checking symbolic links"`" 'AsResponseLine' |
| |
| |
| cli_printMessage '-' 'AsSeparatorLine' |
| |
| local -a LINKS_SRC |
| local -a LINKS_DST |
| local USERFILES='' |
| local PALETTE='' |
| local BRUSH='' |
| local PATTERN='' |
| local FONT='' |
| local FILE='' |
| local COUNT=0 |
| |
| |
| |
| |
| |
| |
| local PREFIX='' |
| |
| |
| local GIMP_USER_DIR=${HOME}/.$(rpm -q gimp | cut -d. -f-2) |
| |
| |
| local INKS_USER_DIR=${HOME}/.inkscape |
| |
| |
| LINKS_SRC[0]=${HOME}/bin/$CLI_PROGRAM |
| LINKS_DST[0]=${CLI_BASEDIR}/${CLI_PROGRAM}.sh |
| |
| |
| local FONTS=$(cli_getFilesList "${HOME}/artwork/trunk/Identity/Fonts" 'denmark\.ttf') |
| for FONT in $FONTS;do |
| LINKS_SRC[((++${ |
| LINKS_DST[((++${ |
| done |
| |
| |
| |
| local PALETTES=$(cli_getFilesList \ |
| "${HOME}/artwork/trunk/Identity/Themes/Motifs/*/*/Palettes |
| ${HOME}/artwork/trunk/Identity/Palettes" ".+\.gpl") |
| for PALETTE in $PALETTES;do |
| if [[ "$PALETTE" =~ "$(cli_getPathComponent '--theme-pattern')" ]];then |
| NAME="$(cli_getRepoName "$(cli_getPathComponent "$PALETTE" '--theme-name')" 'f')-" |
| VERS="$(cli_getPathComponent "$PALETTE" '--theme-release')-" |
| else |
| NAME='' |
| VERS='' |
| fi |
| LINKS_SRC[((++${ |
| LINKS_DST[((++${ |
| LINKS_SRC[((++${ |
| LINKS_DST[((++${ |
| done |
| |
| |
| local BRUSHES=$(cli_getFilesList \ |
| "${HOME}/artwork/trunk/Identity/Themes/Motifs/*/*/Brushes |
| ${HOME}/artwork/trunk/Identity/Brushes" ".+\.(gbr|gih)") |
| for BRUSH in $BRUSHES;do |
| if [[ "$BRUSH" =~ "$(cli_getPathComponent '--theme-pattern')" ]];then |
| NAME="$(cli_getRepoName "$(cli_getPathComponent "$BRUSH" '--theme-name')" 'f')-" |
| VERS="$(cli_getPathComponent "$BRUSH" '--theme-release')-" |
| else |
| NAME='' |
| VERS='' |
| fi |
| LINKS_SRC[((++${ |
| LINKS_DST[((++${ |
| done |
| |
| |
| local PATTERNS=$(cli_getFilesList \ |
| "${HOME}/artwork/trunk/Identity/Themes/Motifs/*/*/Patterns |
| ${HOME}/artwork/trunk/Identity/Patterns" ".+\.png") |
| for PATTERN in $PATTERNS;do |
| if [[ "$PATTERN" =~ "$(cli_getPathComponent '--theme-pattern')" ]];then |
| NAME="$(cli_getRepoName "$(cli_getPathComponent "$PATTERN" '--theme-name')" 'f')-" |
| VERS="$(cli_getPathComponent "$PATTERN" '--theme-release')-" |
| else |
| NAME='' |
| VERS='' |
| fi |
| LINKS_SRC[((++${ |
| LINKS_DST[((++${ |
| done |
| |
| |
| |
| |
| USERFILES=$(cli_getFilesList "${HOME}/.fonts" '.+\.ttf'; |
| cli_getFilesList "${HOME}/bin" '.+\.sh'; |
| cli_getFilesList "${GIMP_USER_DIR}/palettes" '.+\.gpl'; |
| cli_getFilesList "${GIMP_USER_DIR}/brushes" '.+\.(gbr|gih)'; |
| cli_getFilesList "${GIMP_USER_DIR}/patterns" '.+\.png'; |
| cli_getFilesList "${INKS_USER_DIR}/palettes" '.+\.gpl') |
| |
| |
| if [[ "$USERFILES" != '' ]];then |
| cli_printActionPreamble "${USERFILES[*]}" 'doDelete' 'AsResponseLine' |
| for FILE in ${USERFILES[@]};do |
| cli_printMessage "${FILE}" 'AsDeletingLine' |
| rm -r $FILE |
| done |
| fi |
| |
| |
| |
| |
| cli_printActionPreamble "${LINKS_SRC[*]}" 'doCreate' 'AsResponseLine' |
| while [[ $COUNT -lt ${ |
| |
| if [[ -f ${LINKS_SRC[$COUNT]} ]];then |
| cli_printMessage "${LINKS_SRC[$COUNT]}" 'AsUpdatingLine' |
| else |
| cli_printMessage "${LINKS_SRC[$COUNT]}" 'AsCreatingLine' |
| 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 |
| |
| } |