3
# This script prints the standard header that should be at the start
6
# ############################################################################
7
# Standard startup, find the branch's root directory
8
# ############################################################################
19
exit_status=$((exit_status | 1))
23
if [ -n "$PERCONA_TOOLKIT_BRANCH" ]; then
24
BRANCH=$PERCONA_TOOLKIT_BRANCH
26
while [ ! -f Makefile.PL ] && [ $(pwd) != "/" ]; do
29
if [ ! -f Makefile.PL ]; then
30
die "Cannot find the root directory of the Percona Toolkit branch"
36
# ############################################################################
38
# ############################################################################
42
# ############################################################################
44
# ############################################################################
48
# ############################################################################
50
# ############################################################################
54
if [ -z "$tool_file" ]; then
58
if [ ! -f $tool_file ]; then
59
die "$tool_file does not exist"
62
if ! grep -m 1 -q '^use ' $tool_file; then
63
die "This only works for Perl tools"
66
echo "#!/usr/bin/env perl
68
# This program is part of Percona Toolkit: http://www.percona.com/software/
69
# See \"COPYRIGHT, LICENSE, AND WARRANTY\" at the end of this file for legal
70
# notices and disclaimers.
73
use warnings FATAL => 'all';
75
# This tool is \"fat-packed\": most of its dependent modules are embedded
76
# in this file. Setting %INC to this file for each module makes Perl aware
77
# of this so it will not try to load the module from @INC. See the tool's
78
# documentation for a full list of dependencies.
80
\$INC{\$_} = __FILE__ for map { (my \$pkg = \"\$_.pm\") =~ s!::!/!g; \$pkg } (qw("
82
for pkg in $(grep '^package [A-Za-z:]*;' $tool_file | cut -d' ' -f2 | cut -d';' -f1); do