| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function cli_checkPathComponent { |
| |
| |
| local ARGSS='' |
| |
| |
| local ARGSL='release,architecture,theme' |
| |
| |
| |
| local ARGUMENTS='' |
| |
| |
| |
| |
| local FILE='' |
| |
| |
| cli_doParseArgumentsReDef "$@" |
| |
| |
| cli_doParseArguments |
| |
| |
| eval set -- "$ARGUMENTS" |
| |
| |
| local FILES=$(echo $@ | sed -r 's!^.*--[[:space:]](.+)$!\1!') |
| |
| |
| |
| if [[ $FILES == '--' ]];then |
| cli_printMessage "You need to provide one file at least." --as-error-line |
| fi |
| |
| |
| while true; do |
| |
| case "$1" in |
| |
| --release ) |
| for FILE in $(echo $FILES);do |
| if [[ ! $FILE =~ "^.+/$(cli_getPathComponent --release-pattern)/.*$" ]];then |
| cli_printMessage "`eval_gettext "The release \\\"\\\$FILE\\\" is not valid."`" --as-error-line |
| fi |
| done |
| shift 2 |
| break |
| ;; |
| |
| --architecture ) |
| for FILE in $(echo $FILES);do |
| if [[ ! $FILE =~ $(cli_getPathComponent --architecture-pattern) ]];then |
| cli_printMessage "`eval_gettext "The architecture \\\"\\\$FILE\\\" is not valid."`" --as-error-line |
| fi |
| done |
| shift 2 |
| break |
| ;; |
| |
| --theme ) |
| for FILE in $(echo $FILES);do |
| if [[ ! $FILE =~ $(cli_getPathComponent --theme-pattern) ]];then |
| cli_printMessage "`eval_gettext "The theme \\\"\\\$FILE\\\" is not valid."`" --as-error-line |
| fi |
| done |
| shift 2 |
| break |
| ;; |
| |
| -- ) |
| for FILE in $(echo $FILES);do |
| if [[ $FILE == '' ]] \ |
| || [[ $FILE =~ '(\.\.(/)?)' ]] \ |
| || [[ ! $FILE =~ '^[A-Za-z0-9\.:/_-]+$' ]]; then |
| cli_printMessage "`eval_gettext "The value \\\"\\\$FILE\\\" is not valid."`" --as-error-line |
| fi |
| done |
| shift 2 |
| break |
| ;; |
| |
| esac |
| done |
| |
| } |
| |