-
Notifications
You must be signed in to change notification settings - Fork 17
/
makedist
executable file
·124 lines (102 loc) · 2.66 KB
/
makedist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#! /bin/bash
# Functions
#{{{
function usage() {
cat << EOF
Usage: $(basename $0) [ options ] [ <languages list> ]
Create bzip2 tarball for distribution, optionally updates po files before.
Options:
--all-po update all languages
-f, --force force overwriting existing files
-h, --help this help
EOF
}
function err_mess() {
echo "$(basename $0): error: $1" > /dev/stderr;
}
#}}}
# Init costants & parameters
#{{{
NOPO=1
ALL=0
FORCE=0
#}}}
# Parse command line
#{{{
PARAMETERS=$(getopt -a -o "hf" -l "help, all-po, force" -- "$@")
[ $? -ne 0 ] && { usage; exit 1; }
eval set -- "$PARAMETERS"
while true
do
case "$1" in
--force)
FORCE=1
shift
;;
--all)
NOPO=0
ALL=1
shift;
;;
--)
shift;
break;
;;
-h|--help)
usage;
exit 0;
;;
*)
usage;
exit 1;
;;
esac
done
if [ -n "$1" ]
then
[ $ALL -eq 1 ] && { err_mess "use either --all or specify languages"; exit 1; }
ALL=0
NOPO=0
LANGS="$@"
fi
#}}}
# Complete (and check) parameter initialization
#{{{
[ -f "Makefile" ] || { echo "error: makefile not found"; exit 1; }
[ -f "configure.ac" ] || { echo "error: configure.ac not found"; exit 1; }
NAME=$(head -n 50 configure.ac | grep "m4_define(\[plugin_name\], \[.*\])" | sed "s/m4_define(\[plugin_name\], \[\(.*\)\])/\1/")
MAJOR_VER=$(head -n 50 configure.ac | grep "m4_define(\[plugin_major_version\], \[.*\])" | sed "s/m4_define(\[plugin_major_version\], \[\(.*\)\])/\1/")
MINOR_VER=$(head -n 50 configure.ac | grep "m4_define(\[plugin_minor_version\], \[.*\])" | sed "s/m4_define(\[plugin_minor_version\], \[\(.*\)\])/\1/")
MICRO_VER=$(head -n 50 configure.ac | grep "m4_define(\[plugin_micro_version\], \[.*\])" | sed "s/m4_define(\[plugin_micro_version\], \[\(.*\)\])/\1/")
#[ -f "release_subv_src" ] || { echo "error: release_subv_src not found"; exit 1; }
#
#REL_SUB_VER="$(cat release_subv_src)";
#echo "$REL_SUB_VER" | grep -q "[[:digit:]]\+" || { echo "error: invalid release subversion: $REL_SUB_VER"; exit 1;}
#REL_SUB_VER=$[ $REL_SUB_VER + 1 ] || exit 1;
PLUGIN_NAME="${NAME}-${MAJOR_VER}.${MINOR_VER}.${MICRO_VER}"
#NEW_PLUGIN_NAME="${PLUGIN_NAME}-${REL_SUB_VER}"
#TGZ_NAME="${PLUGIN_NAME}.tar.gz"
TBZ2_NAME="${PLUGIN_NAME}.tar.bz2"
#NEW_TBZ2_NAME="${NEW_PLUGIN_NAME}.tar.bz2"
[ $FORCE -eq 0 ] && [ -f "$TBZ2_NAME" ] && { err_mess "file exists, use --force to force writing"; exit 1; }
#}}}
# Main
#{{{
if [ "${NOPO}" -eq 0 ]
then
if [ "${ALL}" -eq 1 ]
then
intltool-update-all || exit 1
else
cd po || exit 1
for LL in $LANGS
do
intltool-update $LL || exit 1
done
cd .. || exit 1
fi
fi
make dist-bzip2 || exit 1
#mv "${TBZ2_NAME}" "${NEW_TBZ2_NAME}" || exit 1
#echo $REL_SUB_VER > release_subv_src;
#}}}