#!/bin/sh -e

# TODO: implement proper $opt_destdir and $prefix option support

shopt -s nullglob

# note on ./$stage && rm -f $stage are split in two lines:
# -e; if ./$stage fails, we do not get here; ./$stage must be the last for -e to work

#set -x

for stage in .git/uupdate/__~.uupdate-step-*.sh ; do
    if [ -x $stage ]; then
	echo "gear-uupdate-execute: executing $stage ..."
	./$stage
	rm -f $stage
    fi
done

exit 0


cat <<EOF

=head1	NAME

gear-uupdate-execute - execute gear-uupdate-prepare scripts.

=head1	DESCRIPTION

B<gear-uupdate-execute> is an utility to execute scripts generated by
B<gear-uupdate-prepare>.

One can call B<gear-uupdate-prepare> && B<gear-uupdate-execute>
instead of B<gear-uupdate> for troubleshooting and better manual control
over B<gear-uupdate>.

B<gear-uupdate> updates gear repository from tarball.
It can used manually or together with rpm-uscan. 
B<gear-uupdate> is a wrapper for B<gear-uupdate-prepare> and B<gear-uupdate-execute>.
B<gear-uupdate-prepare> generates scripts and B<gear-uupdate-execute>
executes them.

=head1	SEE ALSO

gear-uupdate-prepare(1), gear-uupdate(1), rpm-uscan(1).

=head1	AUTHOR

Written by Igor Vlasenko <viy@altlinux.org>.

=head1	COPYING

Copyright (c) 2011-2018 Igor Vlasenko, ALT Linux Team.

This is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.

=cut

EOF
