mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-01 18:25:59 +00:00

* Remove trailing spaces * PR-665 - Remove trailing spaces - Updated not stable test t/pt-online-schema-change/preserve_triggers.t - Updated utilities in bin directory * PR-665 - Remove trailing spaces - Fixed typos * PR-665 - Remove trailing spaces - Fixed typos --------- Co-authored-by: Sveta Smirnova <sveta.smirnova@percona.com>
90 lines
2.2 KiB
Bash
Executable File
90 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# This script prints the standard header that should be at the start
|
|
# of every Perl tool.
|
|
|
|
# ############################################################################
|
|
# Standard startup, find the branch's root directory
|
|
# ############################################################################
|
|
|
|
exit_status=0
|
|
|
|
die() {
|
|
echo $1 >&2
|
|
exit 1
|
|
}
|
|
|
|
warn() {
|
|
echo $1 >&2
|
|
exit_status=$((exit_status | 1))
|
|
}
|
|
|
|
cwd="$PWD"
|
|
if [ -n "$PERCONA_TOOLKIT_BRANCH" ]; then
|
|
BRANCH=$PERCONA_TOOLKIT_BRANCH
|
|
else
|
|
while [ ! -f Makefile.PL ] && [ $(pwd) != "/" ]; do
|
|
cd ..
|
|
done
|
|
if [ ! -f Makefile.PL ]; then
|
|
die "Cannot find the root directory of the Percona Toolkit branch"
|
|
fi
|
|
BRANCH=`pwd`
|
|
fi
|
|
cd "$cwd"
|
|
|
|
# ############################################################################
|
|
# Global variables
|
|
# ############################################################################
|
|
|
|
EXIT_STATUS=0
|
|
|
|
# ############################################################################
|
|
# Subroutines
|
|
# ############################################################################
|
|
|
|
# None
|
|
|
|
# ############################################################################
|
|
# Script starts here
|
|
# ############################################################################
|
|
|
|
tool_file=$1
|
|
|
|
if [ -z "$tool_file" ]; then
|
|
die "Usage: $0 TOOL"
|
|
fi
|
|
|
|
if [ ! -f $tool_file ]; then
|
|
die "$tool_file does not exist"
|
|
fi
|
|
|
|
if ! grep -m 1 -q '^use ' $tool_file; then
|
|
die "This only works for Perl tools"
|
|
fi
|
|
|
|
echo "#!/usr/bin/env perl
|
|
|
|
# This program is part of Percona Toolkit: http://www.percona.com/software/
|
|
# See \"COPYRIGHT, LICENSE, AND WARRANTY\" at the end of this file for legal
|
|
# notices and disclaimers.
|
|
|
|
use strict;
|
|
use warnings FATAL => 'all';
|
|
|
|
# This tool is \"fat-packed\": most of its dependent modules are embedded
|
|
# in this file. Setting %INC to this file for each module makes Perl aware
|
|
# of this so it will not try to load the module from @INC. See the tool's
|
|
# documentation for a full list of dependencies.
|
|
BEGIN {
|
|
\$INC{\$_} = __FILE__ for map { (my \$pkg = \"\$_.pm\") =~ s!::!/!g; \$pkg } (qw("
|
|
|
|
for pkg in $(grep '^package [A-Za-z:]*;' $tool_file | cut -d' ' -f2 | cut -d';' -f1); do
|
|
echo " $pkg"
|
|
done
|
|
|
|
echo " ));
|
|
}";
|
|
|
|
exit $EXIT_STATUS
|