Commit dff8f632 authored by venu@myvenu.com's avatar venu@myvenu.com

Change -IN_RPM -> --rpm and -WINDOWS -> --windows from mysql_install_db

parent 9257a27c
...@@ -11,7 +11,6 @@ CP="cp -p" ...@@ -11,7 +11,6 @@ CP="cp -p"
DEBUG=0 DEBUG=0
SILENT=0 SILENT=0
TMP=/tmp
SUFFIX="" SUFFIX=""
OUTTAR=0 OUTTAR=0
...@@ -34,33 +33,33 @@ if [ ! -f sql/sql_yacc.cc ]; then ...@@ -34,33 +33,33 @@ if [ ! -f sql/sql_yacc.cc ]; then
exit 1 exit 1
fi fi
# #
# Assign the tmp directory if it was set from the environment variables # Debug print of the status
# #
for i in $TMPDIR $TEMPDIR $TEMP print_debug()
do {
if [ $i ]; then for statement
TMP=$i do
break if [ "$DEBUG" = "1" ] ; then
fi echo $statement
done fi
done
}
# #
# Usage of the script # Usage of the script
# #
show_usage() { show_usage()
{
echo "MySQL utility script to create a Windows src package, and it takes" echo "MySQL utility script to create a Windows src package, and it takes"
echo "the following arguments:" echo "the following arguments:"
echo "" echo ""
echo " --debug Debug, without creating the package" echo " --debug Debug, without creating the package"
echo " --tmp Specify the temporary location" echo " --tmp Specify the temporary location"
echo " --silent Do not list verbosely files processed" echo " --silent Do not list verbosely files processed"
echo " --tar Create a tar.gz package instead of .zip" echo " --tar Create tar.gz package instead of .zip"
echo " --help Show this help message" echo " --help Show this help message"
exit 0 exit 0
...@@ -89,6 +88,22 @@ parse_arguments() { ...@@ -89,6 +88,22 @@ parse_arguments() {
parse_arguments "$@" parse_arguments "$@"
#
# Assign the tmp directory if it was set from the environment variables
#
for i in $TMP $TMPDIR $TEMPDIR $TEMP /tmp
do
if [ "$i" ]; then
print_debug "Setting TMP to '$i'"
TMP=$i
break
fi
done
#
# #
# Create a tmp dest directory to copy files # Create a tmp dest directory to copy files
# #
...@@ -96,30 +111,23 @@ parse_arguments "$@" ...@@ -96,30 +111,23 @@ parse_arguments "$@"
BASE=$TMP/my_win_dist$SUFFIX BASE=$TMP/my_win_dist$SUFFIX
if [ -d $BASE ] ; then if [ -d $BASE ] ; then
if [ x$DEBUG = x1 ]; then print_debug "Destination directory '$BASE' already exists, deleting it"
echo "Destination directory '$BASE' already exists, deleting it"
fi
rm -r -f $BASE rm -r -f $BASE
fi fi
$CP -r $SOURCE/VC++Files $BASE $CP -r $SOURCE/VC++Files $BASE
( (
find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print
)|( )|(
while read v while read v
do do
if [ x$DEBUG = x1 ]; then print_debug "Replacing LF -> CRLF from '$v'"
echo "Replacing LF -> CRLF from '$v'"
fi
# ^M -> type CTRL V + CTRL M
cat $v | sed 's/ //' | sed 's/$/ /' > $v.tmp
rm $v
mv $v.tmp $v
# awk '!/r\r$/ {print $0"\r"} /r\r$/ {print $0}' $v > $v # ^M -> type CTRL V + CTRL M
done cat $v | sed 's/ //' | sed 's/$/ /' > $v.tmp
rm $v
mv $v.tmp $v
done
) )
# #
...@@ -127,6 +135,9 @@ done ...@@ -127,6 +135,9 @@ done
# #
$CP -r $SOURCE/sql/share $BASE/ $CP -r $SOURCE/sql/share $BASE/
rm -r -f "$BASE/share/Makefile"
rm -r -f "$BASE/share/Makefile.in"
rm -r -f "$BASE/share/Makefile.am"
# #
# Clean up if we did this from a bk tree # Clean up if we did this from a bk tree
...@@ -135,7 +146,7 @@ $CP -r $SOURCE/sql/share $BASE/ ...@@ -135,7 +146,7 @@ $CP -r $SOURCE/sql/share $BASE/
if [ -d $BASE/SCCS ] if [ -d $BASE/SCCS ]
then then
find $BASE/ -name SCCS -print | xargs rm -r -f find $BASE/ -name SCCS -print | xargs rm -r -f
rm -rf "$BASE/InstallShield/Script Files/SCCS" rm -r -f "$BASE/InstallShield/Script Files/SCCS"
fi fi
mkdir $BASE/Docs $BASE/extra $BASE/include mkdir $BASE/Docs $BASE/extra $BASE/include
...@@ -148,9 +159,7 @@ mkdir $BASE/Docs $BASE/extra $BASE/include ...@@ -148,9 +159,7 @@ mkdir $BASE/Docs $BASE/extra $BASE/include
copy_dir_files() { copy_dir_files() {
for arg do for arg do
if [ x$DEBUG = x1 ]; then print_debug "Copying files from directory '$arg'"
echo "Copying files from directory '$arg'"
fi
cd $SOURCE/$arg/ cd $SOURCE/$arg/
for i in *.c *.h *.ih *.i *.ic *.asm \ for i in *.c *.h *.ih *.i *.ic *.asm \
README INSTALL* LICENSE README INSTALL* LICENSE
...@@ -183,7 +192,8 @@ copy_dir_dirs() { ...@@ -183,7 +192,8 @@ copy_dir_dirs() {
if [ ! -d $BASE/$arg ]; then if [ ! -d $BASE/$arg ]; then
mkdir $BASE/$arg mkdir $BASE/$arg
fi fi
copy_dir_files $arg copy_dir_files $arg
cd $SOURCE/$arg/ cd $SOURCE/$arg/
...@@ -242,9 +252,7 @@ for i in COPYING ChangeLog README \ ...@@ -242,9 +252,7 @@ for i in COPYING ChangeLog README \
Docs/mysqld_error.txt Docs/INSTALL-BINARY Docs/mysqld_error.txt Docs/INSTALL-BINARY
do do
if [ x$DEBUG = x1 ]; then print_debug "Copying file '$i'"
echo "Copying file '$i'"
fi
if [ -f $i ] if [ -f $i ]
then then
$CP $i $BASE/$i $CP $i $BASE/$i
...@@ -256,10 +264,8 @@ done ...@@ -256,10 +264,8 @@ done
# #
if [ -f scripts/mysql_install_db ]; then if [ -f scripts/mysql_install_db ]; then
if [ x$DEBUG = x1 ]; then print_debug "Initializing the 'data' directory"
echo "Initializing the 'data' directory" scripts/mysql_install_db --windows --datadir=$BASE/data
fi
scripts/mysql_install_db -WINDOWS --datadir=$BASE/data
fi fi
...@@ -267,8 +273,10 @@ fi ...@@ -267,8 +273,10 @@ fi
# Specify the distribution package name and copy it # Specify the distribution package name and copy it
# #
NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version$SUFFIX-win-src NEW_DIR_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version$SUFFIX
BASE2=$TMP/$NEW_NAME NEW_NAME=$NEW_DIR_NAME-win-src
BASE2=$TMP/$NEW_DIR_NAME
rm -r -f $BASE2 rm -r -f $BASE2
mv $BASE $BASE2 mv $BASE $BASE2
BASE=$BASE2 BASE=$BASE2
...@@ -277,7 +285,7 @@ BASE=$BASE2 ...@@ -277,7 +285,7 @@ BASE=$BASE2
# If debugging, don't create a zip/tar/gz # If debugging, don't create a zip/tar/gz
# #
if [ x$DEBUG = x1 ] ; then if [ "$DEBUG" = "1" ] ; then
echo "Please check the distribution files from $BASE" echo "Please check the distribution files from $BASE"
echo "Exiting (without creating the package).." echo "Exiting (without creating the package).."
exit exit
...@@ -316,13 +324,13 @@ set_tarzip_options() ...@@ -316,13 +324,13 @@ set_tarzip_options()
{ {
for arg for arg
do do
if [ x$arg = x"tar" ]; then if [ "$arg" = "tar" ]; then
ZIPFILE1=gnutar ZIPFILE1=gnutar
ZIPFILE2=gtar ZIPFILE2=gtar
OPT=cvf OPT=cvf
EXT=".tar" EXT=".tar"
NEED_COMPRESS=1 NEED_COMPRESS=1
if [ x$SILENT = x1 ] ; then if [ "$SILENT" = "1" ] ; then
OPT=cf OPT=cf
fi fi
else else
...@@ -331,14 +339,14 @@ set_tarzip_options() ...@@ -331,14 +339,14 @@ set_tarzip_options()
OPT="-vr" OPT="-vr"
EXT=".zip" EXT=".zip"
NEED_COMPRESS=0 NEED_COMPRESS=0
if [ x$SILENT = x1 ] ; then if [ "$SILENT" = "1" ] ; then
OPT="-r" OPT="-r"
fi fi
fi fi
done done
} }
if [ x$OUTTAR = x1 ]; then if [ "$OUTTAR" = "1" ]; then
set_tarzip_options 'tar' set_tarzip_options 'tar'
else else
set_tarzip_options 'zip' set_tarzip_options 'zip'
...@@ -347,6 +355,7 @@ fi ...@@ -347,6 +355,7 @@ fi
tar=`which_1 $ZIPFILE1 $ZIPFILE2` tar=`which_1 $ZIPFILE1 $ZIPFILE2`
if test "$?" = "1" -o "$tar" = "" if test "$?" = "1" -o "$tar" = ""
then then
print_debug "Search failed for '$ZIPFILE1', '$ZIPFILE2', using default 'tar'"
tar=tar tar=tar
set_tarzip_options 'tar' set_tarzip_options 'tar'
fi fi
...@@ -355,27 +364,21 @@ fi ...@@ -355,27 +364,21 @@ fi
# Create the archive # Create the archive
# #
if [ xDEBUG = x1 ]; then print_debug "Using $tar to create archive"
echo "Using $tar to create archive"
fi
cd $TMP cd $TMP
$tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_NAME $tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_DIR_NAME
cd $SOURCE cd $SOURCE
if [ x$NEED_COMPRESS = x1 ] if [ "$NEED_COMPRESS" = "1" ]
then then
if [ xDEBUG = x1 ]; then print_debug "Compressing archive"
echo "Compressing archive"
fi
gzip -9 $NEW_NAME$EXT gzip -9 $NEW_NAME$EXT
EXT="$EXT.gz" EXT="$EXT.gz"
fi fi
if [ xDEBUG = x1 ]; then print_debug "Removing temporary directory"
echo "Removing temporary directory"
fi
rm -r -f $BASE rm -r -f $BASE
echo "$NEW_NAME$EXT created successfully !!" echo "$NEW_NAME$EXT created successfully !!"
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
# #
# All unrecognized arguments to this script are passed to mysqld. # All unrecognized arguments to this script are passed to mysqld.
IN_RPM=0 in_rpm=0
case "$1" in case "$1" in
-IN-RPM) --rpm)
IN_RPM="1"; shift in_rpm="1"; shift
;; ;;
esac esac
windows=0 windows=0
case "$1" in case "$1" in
-WINDOWS) --windows)
windows="1"; shift windows="1"; shift
;; ;;
esac esac
...@@ -102,7 +102,7 @@ mdata=$ldata/mysql ...@@ -102,7 +102,7 @@ mdata=$ldata/mysql
if test "$windows" -eq 0 -a ! -x $execdir/mysqld if test "$windows" -eq 0 -a ! -x $execdir/mysqld
then then
if test "$IN_RPM" -eq 1 if test "$in_rpm" -eq 1
then then
echo "FATAL ERROR $execdir/mysqld not found!" echo "FATAL ERROR $execdir/mysqld not found!"
exit 1 exit 1
...@@ -116,7 +116,7 @@ fi ...@@ -116,7 +116,7 @@ fi
hostname=`@HOSTNAME@` # Install this too in the user table hostname=`@HOSTNAME@` # Install this too in the user table
# Check if hostname is valid # Check if hostname is valid
if test "$windows" -eq 0 -a "$IN_RPM" -eq 0 -a $force -eq 0 if test "$windows" -eq 0 -a "$in_rpm" -eq 0 -a $force -eq 0
then then
resolved=`$bindir/resolveip $hostname 2>&1` resolved=`$bindir/resolveip $hostname 2>&1`
if [ $? -ne 0 ] if [ $? -ne 0 ]
...@@ -140,7 +140,7 @@ then ...@@ -140,7 +140,7 @@ then
fi fi
# Create database directories mysql & test # Create database directories mysql & test
if test "$IN_RPM" -eq 0 || "$windows" -eq 0 if test "$in_rpm" -eq 0 || "$windows" -eq 0
then then
if test ! -d $ldata; then mkdir $ldata; chmod 700 $ldata ; fi if test ! -d $ldata; then mkdir $ldata; chmod 700 $ldata ; fi
if test ! -d $ldata/mysql; then mkdir $ldata/mysql; chmod 700 $ldata/mysql ; fi if test ! -d $ldata/mysql; then mkdir $ldata/mysql; chmod 700 $ldata/mysql ; fi
...@@ -342,7 +342,7 @@ END_OF_DATA ...@@ -342,7 +342,7 @@ END_OF_DATA
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args" --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args"
then then
echo "" echo ""
if test "$IN_RPM" -eq 0 || "$windows" -eq 0 if test "$in_rpm" -eq 0 || "$windows" -eq 0
then then
echo "To start mysqld at boot time you have to copy support-files/mysql.server" echo "To start mysqld at boot time you have to copy support-files/mysql.server"
echo "to the right place for your system" echo "to the right place for your system"
...@@ -363,7 +363,7 @@ then ...@@ -363,7 +363,7 @@ then
echo "able to use the new GRANT command!" echo "able to use the new GRANT command!"
fi fi
echo echo
if test "$IN_RPM" -eq 0 -a "$windows" -eq 0 if test "$in_rpm" -eq 0 -a "$windows" -eq 0
then then
echo "You can start the MySQL daemon with:" echo "You can start the MySQL daemon with:"
echo "cd @prefix@ ; $bindir/mysqld_safe &" echo "cd @prefix@ ; $bindir/mysqld_safe &"
......
...@@ -368,7 +368,7 @@ useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" mysql 2> /dev/nul ...@@ -368,7 +368,7 @@ useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" mysql 2> /dev/nul
chown -R mysql $mysql_datadir chown -R mysql $mysql_datadir
# Initiate databases # Initiate databases
mysql_install_db -IN-RPM mysql_install_db --rpm
# Change permissions again to fix any new files. # Change permissions again to fix any new files.
chown -R mysql $mysql_datadir chown -R mysql $mysql_datadir
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment