diff --git a/po/gettext.sh b/po/gettext.sh index 4286018..11a8805 100755 --- a/po/gettext.sh +++ b/po/gettext.sh @@ -1,6 +1,6 @@ #!/bin/sh #$Id$ -#Copyright (c) 2010-2013 Pierre Pronchery +#Copyright (c) 2010-2014 Pierre Pronchery # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are met: @@ -26,7 +26,7 @@ #variables PREFIX="/usr/local" -. "../config.sh" +[ -f "../config.sh" ] && . "../config.sh" LOCALEDIR="$PREFIX/share/locale" POTFILES="POTFILES" #executables @@ -49,6 +49,14 @@ _debug() } +#error +_error() +{ + echo "gettext.sh: $@" 1>&2 + return 2 +} + + #usage _usage() { @@ -111,7 +119,7 @@ while getopts "ciuP:" name; do uninstall=1 ;; P) - PREFIX="$2" + PREFIX="$OPTARG" ;; ?) _usage @@ -125,6 +133,12 @@ if [ $# -eq 0 ]; then exit $? fi +#check the variables +if [ -z "$PACKAGE" ]; then + _error "The PACKAGE variable needs to be set" + exit $? +fi + LOCALEDIR="$PREFIX/share/locale" while [ $# -gt 0 ]; do target="$1"