7 Usage: $(basename $0) [ options ]
9 Create zip file with .po files
12 -f, --force force overwriting existing files
18 echo "$(basename $0): error: $1" > /dev
/stderr
;
22 # Init costants & parameters
29 PARAMETERS
=$
(getopt
-a -o "hf" -l "help, force" -- "$@")
31 [[ $?
-ne 0 ]] && { usage
; exit 1; }
33 eval set -- "$PARAMETERS"
57 [[ -n "$1" ]] && { err_mess
"extra arguments in the command line"; usage
; exit 1; }
60 # Complete (and check) parameter initialization
65 [[ -f "Makefile" ]] ||
{ echo "error: makefile not found"; exit 1; }
66 [[ -f "configure.ac" ]] ||
{ echo "error: configure.ac not found"; exit 1; }
68 NAME
=$
(head -n 50 configure.ac |
grep "m4_define(\[plugin_name\], \[.*\])" |
sed "s/m4_define(\[plugin_name\], \[\(.*\)\])/\1/")
69 MAJOR_VER
=$
(head -n 50 configure.ac |
grep "m4_define(\[plugin_major_version\], \[.*\])" |
sed "s/m4_define(\[plugin_major_version\], \[\(.*\)\])/\1/")
70 MINOR_VER
=$
(head -n 50 configure.ac |
grep "m4_define(\[plugin_minor_version\], \[.*\])" |
sed "s/m4_define(\[plugin_minor_version\], \[\(.*\)\])/\1/")
71 MICRO_VER
=$
(head -n 50 configure.ac |
grep "m4_define(\[plugin_micro_version\], \[.*\])" |
sed "s/m4_define(\[plugin_micro_version\], \[\(.*\)\])/\1/")
73 VER
="${MAJOR_VER}.${MINOR_VER}.${MICRO_VER}"
74 ZIP_NAME
="po_${VER}.zip"
76 [[ $FORCE -eq 0 ]] && [[ -f "$ZIP_NAME" ]] && { err_mess
"file ${ZIP_NAME} exists, use --force to force writing"; exit 1; }
78 [[ -d "po" ]] ||
{ err_mess
"po directory not found"; exit 1; }
80 which zip > /dev
/null ||
{ err_mess
"zip command not found"; exit 1; }
88 zip "${ZIP_NAME}" po po
/*.po po
/*.pot ||
exit 1