diff --git a/build/package/rpm/generate-package-info.sh b/build/package/rpm/SOURCES/migrate-icon.gif
old mode 100755
new mode 100644
similarity index 100%
rename from build/package/rpm/generate-package-info.sh
rename to build/package/rpm/SOURCES/migrate-icon.gif
diff --git a/build/package/rpm/make-rpm.sh b/build/package/rpm/SOURCES/mozicon16.xpm
old mode 100755
new mode 100644
similarity index 100%
rename from build/package/rpm/make-rpm.sh
rename to build/package/rpm/SOURCES/mozicon16.xpm
diff --git a/build/package/rpm/mozilla b/build/package/rpm/SOURCES/mozicon50.xpm
similarity index 100%
rename from build/package/rpm/mozilla
rename to build/package/rpm/SOURCES/mozicon50.xpm
diff --git a/build/package/rpm/mozilla-package-list.txt b/build/package/rpm/SOURCES/mozilla-alpha-compiler.patch
similarity index 100%
rename from build/package/rpm/mozilla-package-list.txt
rename to build/package/rpm/SOURCES/mozilla-alpha-compiler.patch
diff --git a/build/package/rpm/mozilla-viewer b/build/package/rpm/SOURCES/mozilla-copy-package-files.sh
old mode 100644
new mode 100755
similarity index 100%
rename from build/package/rpm/mozilla-viewer
rename to build/package/rpm/SOURCES/mozilla-copy-package-files.sh
diff --git a/build/package/rpm/SOURCES/mozilla-editor-overlay-menu.patch b/build/package/rpm/SOURCES/mozilla-editor-overlay-menu.patch
new file mode 100644
index 00000000000..aeb7a4e9131
--- /dev/null
+++ b/build/package/rpm/SOURCES/mozilla-editor-overlay-menu.patch
@@ -0,0 +1,63 @@
+--- mozilla/editor/ui/composer/content/editorOverlay.xul.debug Mon May 14 11:51:19 2001
++++ mozilla/editor/ui/composer/content/editorOverlay.xul Mon May 14 11:51:42 2001
+@@ -791,60 +791,4 @@
+ -->
+
+
+-
+-
+-
+-
+
diff --git a/build/package/rpm/SOURCES/mozilla-icon.png b/build/package/rpm/SOURCES/mozilla-icon.png
new file mode 100644
index 00000000000..3a7d5f9b178
Binary files /dev/null and b/build/package/rpm/SOURCES/mozilla-icon.png differ
diff --git a/build/package/rpm/SOURCES/mozilla-make-package.pl b/build/package/rpm/SOURCES/mozilla-make-package.pl
new file mode 100755
index 00000000000..dc81ba39770
--- /dev/null
+++ b/build/package/rpm/SOURCES/mozilla-make-package.pl
@@ -0,0 +1,193 @@
+#!/usr/bin/perl -w
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is Christopher Blizzard.
+# Portions created by Christopher Blizzard are Copyright (C)
+# Christopher Blizzard. All Rights Reserved.
+#
+# Contributor(s):
+
+# This script will read one of the mozilla packages- file on unix and
+# copy it to a target directory. It's for unix only and is really
+# designed for use in building rpms or other packages.
+
+use Getopt::Long;
+use File::Find;
+
+use strict;
+
+# global vars
+my $srcdir = "";
+my $package_name = "";
+my $package_file = "";
+my $output_file = "";
+my $shared_pass;
+my $retval;
+
+# std return val
+
+$retval = GetOptions('source=s', \$srcdir,
+ 'package=s', \$package_name,
+ 'package-file=s', \$package_file,
+ 'output-file=s', \$output_file,
+ 'shared!', \$shared_pass);
+
+# make sure that all of the values are specific on the command line
+if (!$retval || !$srcdir || !$package_name ||
+ !$package_file || !$output_file) {
+ print_usage();
+ exit 1;
+}
+
+# try to open the packages file
+
+open (PACKAGE_FILE, $package_file) || die("$0: Failed to open file $package_file for reading.");
+
+print "chdir to $srcdir\n";
+chdir($srcdir);
+
+my @file_list;
+my @exclude_list;
+my @final_file_list;
+my $reading_package = 0;
+
+LINE: while () {
+ s/\;.*//; # it's a comment, kill it.
+ s/^\s+//; # nuke leading whitespace
+ s/\s+$//; # nuke trailing whitespace
+
+ # it's a blank line, skip it.
+ if (/^$/) {
+ next LINE;
+ }
+
+ # it's a new component
+ if (/^\[/) {
+ my $this_package;
+ ( $this_package ) = /^\[(.+)\]$/;
+ if ($this_package eq $package_name) {
+ $reading_package = 1;
+ }
+ else {
+ $reading_package = 0;
+ }
+ next LINE;
+ }
+
+ # read this line
+ if ($reading_package) {
+ # see if it's a deletion
+ if (/^-/) {
+ my $this_file;
+ ( $this_file ) = /^-(.+)$/;
+ push (@exclude_list, $this_file);
+ }
+ else {
+ push (@file_list, $_);
+ }
+ }
+}
+
+close PACKAGE_FILE;
+
+# Expand our file list
+
+expand_file_list(\@file_list, \@exclude_list, \@final_file_list);
+
+print "final file list\n";
+foreach (@final_file_list) {
+ print $_ . "\n";
+}
+
+open (OUTPUT_FILE, ">>$output_file") || die("Failed to open output file\n");
+foreach (@final_file_list) {
+ # strip off the bin/
+ s/^bin\///;
+
+ # if it's a shared library and we're doing a shared pass print it.
+ # otherwise ignore it.
+ my $is_shared_library = 0;
+ $is_shared_library = /^[a-zA-Z0-9]+\.so$/;
+ if ($shared_pass && $is_shared_library) {
+ print ("Adding $_\n");
+ print (OUTPUT_FILE $_ . "\n");
+ }
+ elsif (!$shared_pass && !$is_shared_library) {
+ print ("Adding $_\n");
+ print (OUTPUT_FILE $_ . "\n");
+ }
+ else {
+ print("Ignoring $_\n");
+ }
+}
+close OUTPUT_FILE;
+
+#print "\nexlude list\n";
+#foreach (@exclude_list) {
+# print $_ . "\n";
+#}
+
+# this function expands a list of files
+
+sub expand_file_list {
+ my $file_list_ref = shift;
+ my $exclude_list_ref = shift;
+ my $final_file_list_ref = shift;
+ my $this_file;
+ foreach $this_file (@{$file_list_ref}) {
+ # is it a wild card?
+ if ($this_file =~ /\*$/) {
+ print "Wild card $this_file\n";
+ # expand that wild card, removing anything in the exclude
+ # list
+ my @temp_list;
+ @temp_list = glob($this_file);
+ foreach $this_file (@temp_list) {
+ if (!in_exclude_list($this_file, $exclude_list_ref)) {
+ push (@{$final_file_list_ref}, $this_file);
+ }
+ }
+ }
+ else {
+ if (!in_exclude_list($this_file, $exclude_list_ref)) {
+ push (@{$final_file_list_ref}, $this_file);
+ }
+ }
+ }
+}
+
+# is this file in the exlude list?
+
+sub in_exclude_list {
+ my $file = shift;
+ my $exclude_list_ref = shift;
+ my $this_file;
+ foreach $this_file (@{$exclude_list_ref}) {
+ if ($file eq $this_file) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+# print out a usage message
+
+sub print_usage {
+ print ("$0: --source dir --package name --package-file file --output-file file [--shared]\n");
+ print ("\t source is the source directory where the files can be found.\n");
+ print ("\t package is the name of the package to list\n");
+ print ("\t package-file is the file that contains the list of packages\n");
+ print ("\t output-file is the file which will contain the list of files\n");
+ print ("\t shared pulls out only the shared libraries\n");
+}
diff --git a/build/package/rpm/SOURCES/mozilla-navigator-overlay-menu.patch b/build/package/rpm/SOURCES/mozilla-navigator-overlay-menu.patch
new file mode 100644
index 00000000000..c53c0532e05
--- /dev/null
+++ b/build/package/rpm/SOURCES/mozilla-navigator-overlay-menu.patch
@@ -0,0 +1,126 @@
+--- mozilla/xpfe/browser/resources/content/navigatorOverlay.xul.debug Wed Apr 18 22:39:27 2001
++++ mozilla/xpfe/browser/resources/content/navigatorOverlay.xul Wed Apr 18 22:41:09 2001
+@@ -343,123 +343,6 @@
+
+
+
+-
+-
+-
+-
+
+
+
diff --git a/build/package/rpm/mozilla.spec b/build/package/rpm/SOURCES/mozilla-ns-upgrade.desktop
similarity index 100%
rename from build/package/rpm/mozilla.spec
rename to build/package/rpm/SOURCES/mozilla-ns-upgrade.desktop
diff --git a/build/package/rpm/SOURCES/mozilla-prefs-debug.patch b/build/package/rpm/SOURCES/mozilla-prefs-debug.patch
new file mode 100644
index 00000000000..0941a130d70
--- /dev/null
+++ b/build/package/rpm/SOURCES/mozilla-prefs-debug.patch
@@ -0,0 +1,30 @@
+--- mozilla/xpfe/components/prefwindow/resources/content/preftree.xul.debug Mon May 14 12:33:18 2001
++++ mozilla/xpfe/components/prefwindow/resources/content/preftree.xul Mon May 14 12:34:06 2001
+@@ -136,27 +136,6 @@
+
+
+
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+
+
+
diff --git a/build/package/rpm/print-module-filelist.sh b/build/package/rpm/SOURCES/mozilla-profile.desktop
old mode 100755
new mode 100644
similarity index 100%
rename from build/package/rpm/print-module-filelist.sh
rename to build/package/rpm/SOURCES/mozilla-profile.desktop
diff --git a/build/package/rpm/SOURCES/mozilla-redhat-home-page-6.2.patch b/build/package/rpm/SOURCES/mozilla-redhat-home-page-6.2.patch
new file mode 100644
index 00000000000..01fc5891d18
--- /dev/null
+++ b/build/package/rpm/SOURCES/mozilla-redhat-home-page-6.2.patch
@@ -0,0 +1,18 @@
+--- mozilla/xpfe/browser/resources/locale/en-US/region.properties.home-page Mon Feb 26 11:01:33 2001
++++ mozilla/xpfe/browser/resources/locale/en-US/region.properties Mon Feb 26 11:02:09 2001
+@@ -1,5 +1,5 @@
+ # navigator.properties
+-homePageDefault=http://www.mozilla.org/
++homePageDefault=file:///usr/doc/HTML/index.html
+ shopKeyword=keyword:shop [Product]
+ quoteKeyword=keyword:quote [Enter symbol here]
+ localKeyword=keyword:zip [Your zip code]
+@@ -11,7 +11,7 @@
+ #
+ # all.js
+ #
+-browser.startup.homepage=http://www.mozilla.org/
++browser.startup.homepage=file:///usr/doc/HTML/index.html
+ browser.throbber.url=http://www.mozilla.org/
+
+ wallet.Server=http://www.mozilla.org/wallet/tables/
diff --git a/build/package/rpm/SOURCES/mozilla-redhat-home-page.patch b/build/package/rpm/SOURCES/mozilla-redhat-home-page.patch
new file mode 100644
index 00000000000..dc141e5614b
--- /dev/null
+++ b/build/package/rpm/SOURCES/mozilla-redhat-home-page.patch
@@ -0,0 +1,18 @@
+--- mozilla/xpfe/browser/resources/locale/en-US/region.properties.home-page Mon Feb 26 11:01:33 2001
++++ mozilla/xpfe/browser/resources/locale/en-US/region.properties Mon Feb 26 11:02:09 2001
+@@ -1,5 +1,5 @@
+ # navigator.properties
+-homePageDefault=http://www.mozilla.org/
++homePageDefault=file:///usr/share/doc/HTML/index.html
+ shopKeyword=keyword:shop [Product]
+ quoteKeyword=keyword:quote [Enter symbol here]
+ localKeyword=keyword:zip [Your zip code]
+@@ -11,7 +11,7 @@
+ #
+ # all.js
+ #
+-browser.startup.homepage=http://www.mozilla.org/
++browser.startup.homepage=file:///usr/share/doc/HTML/index.html
+ browser.throbber.url=http://www.mozilla.org/
+
+ wallet.Server=http://www.mozilla.org/wallet/tables/
diff --git a/build/package/rpm/print-module-name.sh b/build/package/rpm/SOURCES/mozilla-redhat-mail-home-page.patch
old mode 100755
new mode 100644
similarity index 100%
rename from build/package/rpm/print-module-name.sh
rename to build/package/rpm/SOURCES/mozilla-redhat-mail-home-page.patch
diff --git a/build/package/rpm/SOURCES/mozilla-taskbar-nomozilla.patch b/build/package/rpm/SOURCES/mozilla-taskbar-nomozilla.patch
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/build/package/rpm/SOURCES/mozilla.desktop b/build/package/rpm/SOURCES/mozilla.desktop
new file mode 100644
index 00000000000..c45d05ded3c
--- /dev/null
+++ b/build/package/rpm/SOURCES/mozilla.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=Mozilla
+Comment=Mozilla
+Exec=/usr/bin/mozilla
+Icon=mozilla-icon.png
+Terminal=0
+Type=Application
diff --git a/build/package/rpm/SOURCES/mozilla.sh b/build/package/rpm/SOURCES/mozilla.sh
new file mode 100755
index 00000000000..9e330f52313
--- /dev/null
+++ b/build/package/rpm/SOURCES/mozilla.sh
@@ -0,0 +1,147 @@
+#!/bin/sh
+#
+# The contents of this file are subject to the Netscape Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/NPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+
+##
+## Usage:
+##
+## $ mozilla
+##
+## This script is meant to run a mozilla program from the mozilla
+## rpm installation.
+##
+## The script will setup all the environment voodoo needed to make
+## mozilla work.
+
+##
+## Standard shell script disclaimer blurb thing:
+##
+## This script is a hcak. Its brute force. Its horrible.
+## It doesnt use Artificial Intelligence. It doesnt use Virtual Reality.
+## Its not perl. Its not python. It probably wont work unchanged on
+## the "other" thousands of unices. But it worksforme.
+##
+## If you have an improvement, patch, idea, whatever, on how to make this
+## script better, post it here:
+##
+## news://news.mozilla.org/netscape.public.mozilla.patches
+## news://news.mozilla.org/netscape.public.mozilla.unix
+##
+##
+
+##
+## Potential improvements:
+##
+## + Run ldd on the program and report missing dlls
+## + All the "other" unices/packages
+##
+
+cmdname=`basename $0`
+
+##
+## Variables
+##
+MOZ_DIST_BIN="/usr/lib/mozilla"
+MOZ_PROGRAM="/usr/lib/mozilla/mozilla-bin"
+
+##
+## Set MOZILLA_FIVE_HOME
+##
+MOZILLA_FIVE_HOME="/usr/lib/mozilla"
+
+export MOZILLA_FIVE_HOME
+
+##
+## Set LD_LIBRARY_PATH
+##
+if [ "$LD_LIBRARY_PATH" ]
+then
+ LD_LIBRARY_PATH=/usr/lib/mozilla:/usr/lib/mozilla/plugins:$LD_LIBRARY_PATH
+else
+ LD_LIBRARY_PATH=/usr/lib/mozilla:/usr/lib/mozilla/plugins
+fi
+
+export LD_LIBRARY_PATH
+
+# tell the glibc for 7.1 that we need to use the old thread stack size
+# model
+
+export LD_ASSUME_KERNEL=2.2.5
+
+# If there is no command line argument at all then try to open a new
+# window in an already running instance.
+
+if [ -z "$1" ]; then
+ $MOZ_PROGRAM -remote "openurl(about:blank,new-window)" 2>/dev/null >/dev/null
+ # no window found?
+ RETURN_VAL=$?
+ if [ "$RETURN_VAL" -eq "2" ]; then
+ exec $MOZ_PROGRAM ${1+"$@"}
+ fi
+ if [ "$RETURN_VAL" -eq "0" ]; then
+ exit 0;
+ fi
+ echo "Error sending command."
+ exit $RETURN_VAL
+fi
+
+unset RETURN_VAL
+
+# If there's a command line argument but it doesn't begin with a -
+# it's probably a url. Try to send it to a running instance.
+
+USE_EXIST=0
+opt="$1"
+case "$opt" in
+ -*) ;;
+ *) USE_EXIST=1 ;;
+esac
+
+if [ "$USE_EXIST" -eq "1" ]; then
+ # check to make sure that the command contains at least a :/ in it.
+ echo $opt | grep -e ':/' 2>/dev/null > /dev/null
+ RETURN_VAL=$?
+ if [ "$RETURN_VAL" -eq "1" ]; then
+ # does it begin with a / ?
+ echo $opt | grep -e '^/' 2>/dev/null > /dev/null
+ RETURN_VAL=$?
+ if [ "$RETURN_VAL" -eq "0" ]; then
+ opt="file:$opt"
+ elif [ -e `pwd`/$opt ]; then
+ opt="file://`pwd`/$opt"
+ else
+ opt="http://$opt"
+ fi
+ fi
+ # ok, send it
+ $MOZ_PROGRAM -remote "openurl($opt)" 2>/dev/null > /dev/null
+ RETURN_VAL=$?
+ if [ "$RETURN_VAL" -eq "2" ]; then
+ exec $MOZ_PROGRAM ${1+"$@"}
+ fi
+ if [ "$RETURN_VAL" -eq "0" ]; then
+ exit 0;
+ fi
+ echo "Error sending command."
+ exit $RETURN_VAL
+fi
+
+exec $MOZ_PROGRAM ${1+"$@"}
diff --git a/build/package/rpm/SOURCES/rebuild-databases.sh b/build/package/rpm/SOURCES/rebuild-databases.sh
new file mode 100755
index 00000000000..8528178f962
--- /dev/null
+++ b/build/package/rpm/SOURCES/rebuild-databases.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if [ -f /usr/lib/mozilla/regxpcom ]; then
+
+ /bin/rm -rf /usr/lib/mozilla/chrome/overlayinfo
+ /bin/rm -f /usr/lib/mozilla/chrome/*.rdf
+ /bin/mkdir -p /usr/lib/mozilla/chrome/overlayinfo
+ /bin/rm -f /usr/lib/mozilla/component.reg
+
+ MOZILLA_FIVE_HOME=/usr/lib/mozilla \
+ /usr/lib/mozilla/regxpcom >/dev/null 2>/dev/null
+
+ MOZILLA_FIVE_HOME=/usr/lib/mozilla \
+ /usr/lib/mozilla/regchrome >/dev/null 2>/dev/null
+fi
+
+exit 0