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"
DEBUG=0
SILENT=0
TMP=/tmp
SUFFIX=""
OUTTAR=0
......@@ -34,33 +33,33 @@ if [ ! -f sql/sql_yacc.cc ]; then
exit 1
fi
#
# Assign the tmp directory if it was set from the environment variables
# Debug print of the status
#
for i in $TMPDIR $TEMPDIR $TEMP
do
if [ $i ]; then
TMP=$i
break
print_debug()
{
for statement
do
if [ "$DEBUG" = "1" ] ; then
echo $statement
fi
done
done
}
#
# Usage of the script
#
show_usage() {
show_usage()
{
echo "MySQL utility script to create a Windows src package, and it takes"
echo "the following arguments:"
echo ""
echo " --debug Debug, without creating the package"
echo " --tmp Specify the temporary location"
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"
exit 0
......@@ -89,6 +88,22 @@ 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
#
......@@ -96,30 +111,23 @@ parse_arguments "$@"
BASE=$TMP/my_win_dist$SUFFIX
if [ -d $BASE ] ; then
if [ x$DEBUG = x1 ]; then
echo "Destination directory '$BASE' already exists, deleting it"
fi
print_debug "Destination directory '$BASE' already exists, deleting it"
rm -r -f $BASE
fi
$CP -r $SOURCE/VC++Files $BASE
(
find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print
)|(
while read v
do
if [ x$DEBUG = x1 ]; then
echo "Replacing LF -> CRLF from '$v'"
fi
while read v
do
print_debug "Replacing LF -> CRLF from '$v'"
# ^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
done
done
)
#
......@@ -127,6 +135,9 @@ done
#
$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
......@@ -135,7 +146,7 @@ $CP -r $SOURCE/sql/share $BASE/
if [ -d $BASE/SCCS ]
then
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
mkdir $BASE/Docs $BASE/extra $BASE/include
......@@ -148,9 +159,7 @@ mkdir $BASE/Docs $BASE/extra $BASE/include
copy_dir_files() {
for arg do
if [ x$DEBUG = x1 ]; then
echo "Copying files from directory '$arg'"
fi
print_debug "Copying files from directory '$arg'"
cd $SOURCE/$arg/
for i in *.c *.h *.ih *.i *.ic *.asm \
README INSTALL* LICENSE
......@@ -184,6 +193,7 @@ copy_dir_dirs() {
if [ ! -d $BASE/$arg ]; then
mkdir $BASE/$arg
fi
copy_dir_files $arg
cd $SOURCE/$arg/
......@@ -242,9 +252,7 @@ for i in COPYING ChangeLog README \
Docs/mysqld_error.txt Docs/INSTALL-BINARY
do
if [ x$DEBUG = x1 ]; then
echo "Copying file '$i'"
fi
print_debug "Copying file '$i'"
if [ -f $i ]
then
$CP $i $BASE/$i
......@@ -256,10 +264,8 @@ done
#
if [ -f scripts/mysql_install_db ]; then
if [ x$DEBUG = x1 ]; then
echo "Initializing the 'data' directory"
fi
scripts/mysql_install_db -WINDOWS --datadir=$BASE/data
print_debug "Initializing the 'data' directory"
scripts/mysql_install_db --windows --datadir=$BASE/data
fi
......@@ -267,8 +273,10 @@ fi
# Specify the distribution package name and copy it
#
NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version$SUFFIX-win-src
BASE2=$TMP/$NEW_NAME
NEW_DIR_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version$SUFFIX
NEW_NAME=$NEW_DIR_NAME-win-src
BASE2=$TMP/$NEW_DIR_NAME
rm -r -f $BASE2
mv $BASE $BASE2
BASE=$BASE2
......@@ -277,7 +285,7 @@ BASE=$BASE2
# 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 "Exiting (without creating the package).."
exit
......@@ -316,13 +324,13 @@ set_tarzip_options()
{
for arg
do
if [ x$arg = x"tar" ]; then
if [ "$arg" = "tar" ]; then
ZIPFILE1=gnutar
ZIPFILE2=gtar
OPT=cvf
EXT=".tar"
NEED_COMPRESS=1
if [ x$SILENT = x1 ] ; then
if [ "$SILENT" = "1" ] ; then
OPT=cf
fi
else
......@@ -331,14 +339,14 @@ set_tarzip_options()
OPT="-vr"
EXT=".zip"
NEED_COMPRESS=0
if [ x$SILENT = x1 ] ; then
if [ "$SILENT" = "1" ] ; then
OPT="-r"
fi
fi
done
}
if [ x$OUTTAR = x1 ]; then
if [ "$OUTTAR" = "1" ]; then
set_tarzip_options 'tar'
else
set_tarzip_options 'zip'
......@@ -347,6 +355,7 @@ fi
tar=`which_1 $ZIPFILE1 $ZIPFILE2`
if test "$?" = "1" -o "$tar" = ""
then
print_debug "Search failed for '$ZIPFILE1', '$ZIPFILE2', using default 'tar'"
tar=tar
set_tarzip_options 'tar'
fi
......@@ -355,27 +364,21 @@ fi
# Create the archive
#
if [ xDEBUG = x1 ]; then
echo "Using $tar to create archive"
fi
print_debug "Using $tar to create archive"
cd $TMP
$tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_NAME
$tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_DIR_NAME
cd $SOURCE
if [ x$NEED_COMPRESS = x1 ]
if [ "$NEED_COMPRESS" = "1" ]
then
if [ xDEBUG = x1 ]; then
echo "Compressing archive"
fi
print_debug "Compressing archive"
gzip -9 $NEW_NAME$EXT
EXT="$EXT.gz"
fi
if [ xDEBUG = x1 ]; then
echo "Removing temporary directory"
fi
print_debug "Removing temporary directory"
rm -r -f $BASE
echo "$NEW_NAME$EXT created successfully !!"
......
......@@ -7,15 +7,15 @@
#
# All unrecognized arguments to this script are passed to mysqld.
IN_RPM=0
in_rpm=0
case "$1" in
-IN-RPM)
IN_RPM="1"; shift
--rpm)
in_rpm="1"; shift
;;
esac
windows=0
case "$1" in
-WINDOWS)
--windows)
windows="1"; shift
;;
esac
......@@ -102,7 +102,7 @@ mdata=$ldata/mysql
if test "$windows" -eq 0 -a ! -x $execdir/mysqld
then
if test "$IN_RPM" -eq 1
if test "$in_rpm" -eq 1
then
echo "FATAL ERROR $execdir/mysqld not found!"
exit 1
......@@ -116,7 +116,7 @@ fi
hostname=`@HOSTNAME@` # Install this too in the user table
# 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
resolved=`$bindir/resolveip $hostname 2>&1`
if [ $? -ne 0 ]
......@@ -140,7 +140,7 @@ then
fi
# Create database directories mysql & test
if test "$IN_RPM" -eq 0 || "$windows" -eq 0
if test "$in_rpm" -eq 0 || "$windows" -eq 0
then
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
......@@ -342,7 +342,7 @@ END_OF_DATA
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args"
then
echo ""
if test "$IN_RPM" -eq 0 || "$windows" -eq 0
if test "$in_rpm" -eq 0 || "$windows" -eq 0
then
echo "To start mysqld at boot time you have to copy support-files/mysql.server"
echo "to the right place for your system"
......@@ -363,7 +363,7 @@ then
echo "able to use the new GRANT command!"
fi
echo
if test "$IN_RPM" -eq 0 -a "$windows" -eq 0
if test "$in_rpm" -eq 0 -a "$windows" -eq 0
then
echo "You can start the MySQL daemon with:"
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
chown -R mysql $mysql_datadir
# Initiate databases
mysql_install_db -IN-RPM
mysql_install_db --rpm
# Change permissions again to fix any new files.
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