3 # A Nautilus extension which offers configurable context menu actions.
5 # Copyright (C) 2005 The GNOME Foundation
6 # Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
7 # Copyright (C) 2009, 2010, 2011 Pierre Wieser and others (see AUTHORS)
9 # This Program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation; either version 2 of
12 # the License, or (at your option) any later version.
14 # This Program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public
20 # License along with this Library; see the file COPYING. If not,
21 # write to the Free Software Foundation, Inc., 59 Temple Place,
22 # Suite 330, Boston, MA 02111-1307, USA.
25 # Frederic Ruaudel <grumz@grumz.net>
26 # Rodrigo Moya <rodrigo@gnome-db.org>
27 # Pierre Wieser <pwieser@trychlos.org>
28 # ... and many others (see AUTHORS)
30 errs
=0 # will be the exit code of the script
31 my_cmd
="${0}" # e.g. "./make-ks.sh"
32 my_parms
="$*" # e.g. "-host toaster"
33 my_cmdline
="${my_cmd} ${my_parms}"
34 me
="$(basename ${my_cmd})" # e.g. "make-ks.sh"
35 # used in msg and msgerr functions
36 my_tmproot
="/tmp/$(echo ${me} | sed 's?\..*$??').$$"
37 # e.g. "/tmp/make-ks.1978"
39 # These three functions must be defined using the name() syntax in order
40 # to share traps with the caller process (cf. man (1) ksh).
45 [ "${opt_verbose}" = "yes" -o ${errs} -gt 0 ] && msg "exiting with code ${errs}"
51 msg
"quitting on keyboard interrupt"
58 [ "${opt_verbose}" = "yes" ] && msg
"quitting on TERM signal"
62 # setup the different trap functions
67 function clear_tmpfiles
69 \rm
-f ${my_tmproot}.
*
75 [ $# -ge 2 ] && _eol
="${2}"
76 printf "[%s] %s${_eol}" ${me} "${1}"
82 msg
"error: ${1}" 1>&2
88 msg
"warning: ${1}" 1>&2
96 This script releases a new Nautilus-Actions version.
98 Usage: ${my_cmd} [options]
99 --[no]help print this message, and exit [${opt_help_def}]
100 --[no]version print script version, and exit [${opt_version_def}]
101 --[no]dummy dummy execution [${opt_dummy_def}]
102 --[no]verbose runs verbosely [${opt_verbose_def}]
103 --tarname=<tarname> the tarname to be released [${opt_tarname_def}]
104 --[no]stable whether this is a stable version [${opt_stable_def}]"
109 pck_name
=$
(grep '^PACKAGE_NAME' Makefile
2>/dev
/null |
awk '{ print $3 }')
110 pck_version
=$
(grep '^PACKAGE_VERSION' Makefile
2>/dev
/null |
awk '{ print $3 }')
112 ${pck_name} v ${pck_version}
113 Copyright (C) 2010, 2011 Pierre Wieser."
116 # initialize common command-line options
127 # a first loop over command line arguments to detect verbose mode
130 # break when all arguments have been read
137 # get and try to interpret the next argument
141 # make all options have two hyphens
142 _orig_option
=${_option}
151 # now process options and their argument
153 --noverb |
--noverbo |
--noverbos |
--noverbose)
156 --verb |
--verbo |
--verbos |
--verbose)
162 [ "${opt_verbose}" = "yes" ] && msg
"setting opt_verbose to 'yes'"
164 # we have scanned all command-line arguments in order to detect an
165 # opt_verbose option;
166 # reset now arguments so that they can be scanned again in main script
169 # interpreting command-line arguments
170 product
="$(grep -e '^PACKAGE_TARNAME' Makefile 2>/dev/null | awk '{ print $3 }')"
171 version
="$(grep PACKAGE_VERSION Makefile 2>/dev/null | awk '{ print $3 }')"
173 opt_tarname_def
="${product}-${version}.tar.gz"
176 minor
=$
(echo ${version} | cut
-d.
-f2)
178 [ ${rest} -eq 0 ] && opt_stable_def
="yes" || opt_stable_def
="no"
180 # loop over command line arguments
184 # break when all arguments have been read
191 # get and try to interpret the next argument
195 # make all options have two hyphens
196 orig_option
=${option}
205 # split and extract argument for options that take one
208 optarg
=$
(echo ${option} |
sed -e 's/^[^=]*=//')
209 option
=$
(echo ${option} |
sed 's/=.*//')
211 # these options take a mandatory argument
212 # since, we didn't find it in 'option', so it should be
213 # next word in the command line
214 --t |
--ta |
--tar |
--tarn |
--tarna |
--tarnam |
--tarname)
220 # now process options and their argument
222 --d |
--du |
--dum |
--dumm |
--dummy)
223 [ "${opt_verbose}" = "yes" ] && msg
"setting opt_dummy to 'yes'"
226 --h |
--he |
--hel |
--help)
227 [ "${opt_verbose}" = "yes" ] && msg
"setting opt_help to 'yes'"
230 --nod |
--nodu |
--nodum |
--nodumm |
--nodummy)
231 [ "${opt_verbose}" = "yes" ] && msg
"setting opt_dummy to 'no'"
234 --noh |
--nohe |
--nohel |
--nohelp)
235 [ "${opt_verbose}" = "yes" ] && msg
"setting opt_help to 'no'"
238 --nos |
--nost |
--nosta |
--nostab |
--nostabl |
--nostable)
239 [ "${opt_verbose}" = "yes" ] && msg
"setting opt_stable to 'no'"
242 --noverb |
--noverbo |
--noverbos |
--noverbose)
244 --novers |
--noversi |
--noversio |
--noversion)
245 [ "${opt_verbose}" = "yes" ] && msg
"setting opt_version to 'no'"
248 --s |
--st |
--sta |
--stab |
--stabl |
--stable)
249 [ "${opt_verbose}" = "yes" ] && msg
"setting opt_stable to 'yes'"
252 --t |
--ta |
--tar |
--tarn |
--tarna |
--tarnam |
--tarname)
253 [ "${opt_verbose}" = "yes" ] && msg
"setting opt_tarname to '${optarg}'"
254 opt_tarname
="${optarg}"
256 --verb |
--verbo |
--verbos |
--verbose)
258 --vers |
--versi |
--versio |
--version)
259 [ "${opt_verbose}" = "yes" ] && msg
"setting opt_version to 'yes'"
263 msgerr
"unrecognized option: '${orig_option}'"
266 # positional parameters
269 #if [ ${pos} -eq 1 ]; then
270 # [ "${opt_verbose}" = "yes" ] && msg "setting opt_output to '${option}'"
271 # opt_output=${option}
273 msgerr
"unexpected positional parameter #${pos}: '${option}'"
280 # set option defaults
281 # does not work with /bin/sh ??
282 #set | grep -e '^opt_' | cut -d= -f1 | while read _name; do
283 # if [ "$(echo ${_name} | sed 's/.*\(_def\)/\1/')" != "_def" ]; then
284 # _value="$(eval echo "$"${_name})"
285 # if [ "${_value}" = "" ]; then
286 # eval ${_name}="$(eval echo "$"${_name}_def)"
291 opt_help
=${opt_help:-${opt_help_def}}
292 opt_dummy
=${opt_dummy:-${opt_dummy_def}}
293 opt_verbose
=${opt_verbose:-${opt_verbose_def}}
294 opt_version
=${opt_version:-${opt_version_def}}
296 opt_tarname
=${opt_tarname:-${opt_tarname_def}}
297 opt_stable
=${opt_stable:-${opt_stable_def}}
299 if [ "${opt_help}" = "yes" -o ${nbopt} -eq 0 ]; then
305 if [ "${opt_version}" = "yes" ]; then
311 if [ ! -f "${opt_tarname}" ]; then
312 msgerr
"${opt_tarname} not found, do you have 'make distcheck' ?"
316 if [ ${errs} -gt 0 ]; then
317 msg
"${errs} error(s) have been detected"
318 msg
"try '${my_cmd} --help' for usage"
322 # returns the last return code which happens to be the eval one
329 if [ "${opt_dummy}" = "yes" -o "${opt_verbose}" = "yes" ]; then
331 [ "${opt_dummy}" = "yes" ] && _prefix
="[dummy] "
332 msg
" ${_prefix}${_cmd}..." " "
335 if [ "${opt_dummy}" = "no" ]; then
339 if [ "${opt_verbose}" = "yes" ]; then
344 if [ "${opt_dummy}" = "yes" -o "${opt_verbose}" = "yes" ]; then
345 [ ${_ret} -eq 0 ] && echo "OK" ||
echo "NOT OK"
352 # ---------------------------------------------------------------------
355 [ "${opt_stable}" = "yes" ] && lib_stable
="stable" || lib_stable
="unstable"
356 msg
"releasing ${lib_stable} ${opt_tarname}"
358 msg
" are you OK to release (y/N) ?" " "
361 key
=$
(echo $key |
tr '[:upper:]' '[:lower:]')
362 [ "$key" = "y" -o "$key" = "n" -o "$key" = "" ] && break
364 [ "$key" = "y" ] && echo "Yes" ||
echo "No"
365 [ "$key" != "y" ] && exit
368 destdir
="/net/data/tarballs/${product}"
369 desthost
="stormy.trychlos.org"
370 [ "$(ls ${destdir} 2>/dev/null)" = "" ] && local="no" ||
local="yes"
371 [ "${local}" = "yes" ] && lib_desthost
="" || lib_desthost
="${desthost}:"
372 [ "${opt_verbose}" = "yes" ] && msg
"stormy tarballs repository is local: ${local}"
374 # installing on stormy tarballs repository
375 msg
"installing in ${lib_desthost}${destdir}"
376 cmd
="mkdir -p "${destdir}""
377 [ "${local}" = "yes" ] && command "${cmd}" || command "ssh ${desthost} '${cmd}'"
378 command "scp -v "${opt_tarname}" "${lib_desthost}${destdir}/""
379 cmd
="sha1sum ${destdir}/${opt_tarname} > ${destdir}/${opt_tarname}.sha1sum"
380 [ "${local}" = "yes" ] && command "${cmd}" || command "ssh ${desthost} '${cmd}'"
381 if [ "${opt_stable}" = "yes" ]; then
382 msg
"updating ${lib_desthost}${destdir}/latest.tar.gz"
383 cmd
="(cd ${destdir}; rm -f latest.tar.gz; ln -s ${opt_tarname} latest.tar.gz; ls -l latest.tar.gz ${opt_tarname}*)"
384 [ "${local}" = "yes" ] && command "${cmd}" || command "ssh ${desthost} '${cmd}'"
387 # installing on gnome.org
388 msg
"installing on gnome.org"
389 command "scp "${opt_tarname}" pwieser@master.gnome.org:"
390 command "ssh pwieser@master.gnome.org install-module -u ${opt_tarname}"
392 # installing on kimsufi
393 msg
"installing on kimsufi"
394 destdir
="/home/www/${product}/tarballs"
395 command "scp "${opt_tarname}" maintainer@kimsufi:${destdir}/"
396 command "ssh maintainer@kimsufi 'sha1sum ${destdir}/${opt_tarname} > ${destdir}/${opt_tarname}.sha1sum'"
397 if [ "${opt_stable}" = "yes" ]; then
398 msg
"updating kimsufi:${destdir}/latest.tar.gz"
399 command "ssh maintainer@kimsufi 'cd ${destdir}; rm -f latest.tar.gz; ln -s ${opt_tarname} latest.tar.gz; ls -l latest.tar.gz ${opt_tarname}*'"
404 tag
="$(echo ${product}-${version} | tr '[:lower:]' '[:upper:]' | sed -e 's/-/_/g' -e 's/\./_/g')"
405 msg
="Releasing $(grep PACKAGE_NAME Makefile | awk '{ print $3 }') ${version}"
406 msg
"git tag -s ${tag} -m ${msg}"
407 command "git tag -s '${tag}' -m '${msg}'"
408 command "git pull --rebase && git push && git push --tags"
410 # compressing git local repository
411 msg
"compressing local git repository"
414 msg
"Successfully ended. You may now send your mail."