summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authormmoss@chromium.org <mmoss@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 17:05:40 +0000
committermmoss@chromium.org <mmoss@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 17:05:40 +0000
commitd06897cd499b0ac6048f669cc3dd78d350237094 (patch)
tree6c1f7eb8805f7da4953ba32d0b07653dde7c269f /chrome/installer
parent489d73e7fca72f29bd6620e268609133aa217795 (diff)
downloadchromium_src-d06897cd499b0ac6048f669cc3dd78d350237094.zip
chromium_src-d06897cd499b0ac6048f669cc3dd78d350237094.tar.gz
chromium_src-d06897cd499b0ac6048f669cc3dd78d350237094.tar.bz2
Script and configs to generate Debian packages from current build.
Packages are manually generated now (run ./build.sh after a successful static build), but will be integrated into the main build system soon. Review URL: http://codereview.chromium.org/39088 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11250 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/linux/common/apt.include99
-rw-r--r--chrome/installer/linux/common/chromium-browser/chromium-browser.info64
-rw-r--r--chrome/installer/linux/common/chromium-browser/chromium-browser.pngbin0 -> 4850 bytes
-rw-r--r--chrome/installer/linux/common/desktop.template10
-rwxr-xr-xchrome/installer/linux/common/updater26
-rw-r--r--chrome/installer/linux/common/wrapper9
-rwxr-xr-xchrome/installer/linux/debian/build.sh310
-rw-r--r--chrome/installer/linux/debian/changelog.template4
-rw-r--r--chrome/installer/linux/debian/control.template15
-rwxr-xr-xchrome/installer/linux/debian/postinst54
-rwxr-xr-xchrome/installer/linux/debian/prerm18
11 files changed, 609 insertions, 0 deletions
diff --git a/chrome/installer/linux/common/apt.include b/chrome/installer/linux/common/apt.include
new file mode 100644
index 0000000..d071733
--- /dev/null
+++ b/chrome/installer/linux/common/apt.include
@@ -0,0 +1,99 @@
+# TODO(mmoss) Support configuring multiple repositories (e.g. stable and
+# testing)
+REPOCONFIG="@@REPOCONFIG@@"
+
+APT_GET="`which apt-get 2> /dev/null`"
+APT_CONFIG="`which apt-config 2> /dev/null`"
+
+# Parse apt configuration and return requested variable value.
+apt_config_val() {
+ APTVAR="$1"
+ if [ -x "$APT_CONFIG" ]; then
+ "$APT_CONFIG" dump | sed -e "/^$APTVAR /"'!d' -e "s/^$APTVAR \"\(.*\)\".*/\1/"
+ fi
+}
+
+# Install the repository signing key (see also:
+# http://www.google.com/linuxrepositories/aboutkey.html)
+install_key() {
+ APT_KEY="`which apt-key 2> /dev/null`"
+ if [ -x "$APT_KEY" ]; then
+ "$APT_KEY" add - >/dev/null 2>&1 <<KEYDATA
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.2.2 (GNU/Linux)
+
+mQGiBEXwb0YRBADQva2NLpYXxgjNkbuP0LnPoEXruGmvi3XMIxjEUFuGNCP4Rj/a
+kv2E5VixBP1vcQFDRJ+p1puh8NU0XERlhpyZrVMzzS/RdWdyXf7E5S8oqNXsoD1z
+fvmI+i9b2EhHAA19Kgw7ifV8vMa4tkwslEmcTiwiw8lyUl28Wh4Et8SxzwCggDcA
+feGqtn3PP5YAdD0km4S4XeMEAJjlrqPoPv2Gf//tfznY2UyS9PUqFCPLHgFLe80u
+QhI2U5jt6jUKN4fHauvR6z3seSAsh1YyzyZCKxJFEKXCCqnrFSoh4WSJsbFNc4PN
+b0V0SqiTCkWADZyLT5wll8sWuQ5ylTf3z1ENoHf+G3um3/wk/+xmEHvj9HCTBEXP
+78X0A/0Tqlhc2RBnEf+AqxWvM8sk8LzJI/XGjwBvKfXe+l3rnSR2kEAvGzj5Sg0X
+4XmfTg4Jl8BNjWyvm2Wmjfet41LPmYJKsux3g0b8yzQxeOA4pQKKAU3Z4+rgzGmf
+HdwCG5MNT2A5XxD/eDd+L4fRx0HbFkIQoAi1J3YWQSiTk15fw7RMR29vZ2xlLCBJ
+bmMuIExpbnV4IFBhY2thZ2UgU2lnbmluZyBLZXkgPGxpbnV4LXBhY2thZ2VzLWtl
+eW1hc3RlckBnb29nbGUuY29tPohjBBMRAgAjAhsDBgsJCAcDAgQVAggDBBYCAwEC
+HgECF4AFAkYVdn8CGQEACgkQoECDD3+sWZHKSgCfdq3HtNYJLv+XZleb6HN4zOcF
+AJEAniSFbuv8V5FSHxeRimHx25671az+uQINBEXwb0sQCACuA8HT2nr+FM5y/kzI
+A51ZcC46KFtIDgjQJ31Q3OrkYP8LbxOpKMRIzvOZrsjOlFmDVqitiVc7qj3lYp6U
+rgNVaFv6Qu4bo2/ctjNHDDBdv6nufmusJUWq/9TwieepM/cwnXd+HMxu1XBKRVk9
+XyAZ9SvfcW4EtxVgysI+XlptKFa5JCqFM3qJllVohMmr7lMwO8+sxTWTXqxsptJo
+pZeKz+UBEEqPyw7CUIVYGC9ENEtIMFvAvPqnhj1GS96REMpry+5s9WKuLEaclWpd
+K3krttbDlY1NaeQUCRvBYZ8iAG9YSLHUHMTuI2oea07Rh4dtIAqPwAX8xn36JAYG
+2vgLAAMFB/wKqaycjWAZwIe98Yt0qHsdkpmIbarD9fGiA6kfkK/UxjL/k7tmS4Vm
+CljrrDZkPSQ/19mpdRcGXtb0NI9+nyM5trweTvtPw+HPkDiJlTaiCcx+izg79Fj9
+KcofuNb3lPdXZb9tzf5oDnmm/B+4vkeTuEZJ//IFty8cmvCpzvY+DAz1Vo9rA+Zn
+cpWY1n6z6oSS9AsyT/IFlWWBZZ17SpMHu+h4Bxy62+AbPHKGSujEGQhWq8ZRoJAT
+G0KSObnmZ7FwFWu1e9XFoUCt0bSjiJWTIyaObMrWu/LvJ3e9I87HseSJStfw6fki
+5og9qFEkMrIrBCp3QGuQWBq/rTdMuwNFiEkEGBECAAkFAkXwb0sCGwwACgkQoECD
+D3+sWZF/WACfeNAu1/1hwZtUo1bR+MWiCjpvHtwAnA1R3IHqFLQ2X3xJ40XPuAyY
+/FJG
+=Quqp
+-----END PGP PUBLIC KEY BLOCK-----
+KEYDATA
+ fi
+}
+
+# Add the Google repository to the apt sources.
+# Returns:
+# 0 - no update necessary
+# 1 - sources were updated
+# 2 - error
+update_sources_lists() {
+ APTDIR=$(apt_config_val Dir)
+ APTETC=$(apt_config_val 'Dir::Etc')
+ APT_SOURCES="$APTDIR$APTETC$(apt_config_val 'Dir::Etc::sourcelist')"
+ APT_SOURCESDIR="$APTDIR$APTETC$(apt_config_val 'Dir::Etc::sourceparts')"
+
+ if [ -d "$APT_SOURCESDIR" ]; then
+ # Nothing to do if it's already there.
+ SOURCELIST=$(grep -H "$REPOCONFIG" "$APT_SOURCESDIR/@@PACKAGE@@.list" \
+ 2>/dev/null | cut -d ':' -f 1)
+ if [ -n "$SOURCELIST" ]; then
+ return 0
+ fi
+
+ printf "$REPOCONFIG\n" > "$APT_SOURCESDIR/@@PACKAGE@@.list"
+ if [ $? -eq 0 ]; then
+ return 1
+ fi
+ fi
+ # TODO(mmoss) What are the chances that any distro we support doesn't provide
+ # APT_SOURCESDIR nowadays? Should we just bail if we get here? It makes
+ # cleanup easier if we don't have to worry about undoing changes to
+ # APT_SOURCES, which may conflict with other changes or manual edits.
+
+ # Nothing to do if it's already there.
+ SOURCELIST=$(grep -H "$REPOCONFIG" "$APT_SOURCES" 2>/dev/null \
+ | cut -d ':' -f 1)
+ if [ -n "$SOURCELIST" ]; then
+ return 0
+ fi
+
+ if [ -w "$APT_SOURCES" ]; then
+ printf "$REPOCONFIG\n" >> "$APT_SOURCES"
+ return 1
+ fi
+
+ return 2
+}
diff --git a/chrome/installer/linux/common/chromium-browser/chromium-browser.info b/chrome/installer/linux/common/chromium-browser/chromium-browser.info
new file mode 100644
index 0000000..fc6606e
--- /dev/null
+++ b/chrome/installer/linux/common/chromium-browser/chromium-browser.info
@@ -0,0 +1,64 @@
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# This file provides common configuration information for building
+# chromium-browser packages for various platforms.
+
+
+# Determine the string to use for package versioning. The strings are placed in
+# the VERSION, REVISION, and VERSIONFULL variables and should be formatted
+# appropriately for a variety of package standards.
+get_versioninfo() {
+ EPOCHTIME=$(date +"%s")
+ # TODO(mmoss) Use the real version once we start packaging a real browser
+ VERSION="0.0.0.1"
+ # Support both svn and git clients to get the latest revision.
+ set +e
+ git config -l 2>/dev/null | grep -qs -E "chrome|chromium"
+ if [ $? -eq 0 ]; then
+ REVISION=$(git-svn info | sed -e '/^Revision: */!d' -e "s/Revision: *//")
+ if [ -n "$REVISION" ]; then
+ if [ "$REVISION" != "$(git-svn find-rev HEAD)" ]; then
+ REVISION+="custom"
+ fi
+ fi
+ else
+ svn info 2>/dev/null | grep -qs -E "chrome|chromium"
+ if [ $? -eq 0 ]; then
+ REVISION=$(svn info | sed -e '/^Revision: */!d' -e "s/Revision: *//")
+ fi
+ fi
+ set -e
+ if [ -z "$REVISION" ]; then
+ echo "Error: Could not determine source revision."
+ exit 1
+ fi
+ VERSIONFULL="${VERSION}-${EPOCHTIME}r${REVISION}"
+}
+
+# Base name of the package.
+PACKAGE="chromium-browser"
+
+# Filename of the main executable (for generating launcher scripts, etc.)
+PROGNAME=chrome
+
+# Base directory for package installation.
+INSTALLDIR=/opt/chromium.org/chromium
+
+# Display string for desktop menu/icon.
+MENUNAME="Chromium Web Browser"
+
+# Brief package description.
+SHORTDESC="The web browser from Chromium.org"
+
+# Detailed package description.
+FULLDESC="Chromium is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier."
+
+# Package maintainer information.
+# TODO(mmoss) Setup a mailbox for this address
+MAINTNAME="Chromium Linux Team"
+MAINTMAIL="chromium-linux-packager@chromium.org"
+
+# TODO(mmoss) This is the dogfooding config. Need to update for release.
+REPOCONFIG="deb http://dl.google.com/linux/deb.GOOGLER/ testing main"
diff --git a/chrome/installer/linux/common/chromium-browser/chromium-browser.png b/chrome/installer/linux/common/chromium-browser/chromium-browser.png
new file mode 100644
index 0000000..df47815
--- /dev/null
+++ b/chrome/installer/linux/common/chromium-browser/chromium-browser.png
Binary files differ
diff --git a/chrome/installer/linux/common/desktop.template b/chrome/installer/linux/common/desktop.template
new file mode 100644
index 0000000..15b59ce
--- /dev/null
+++ b/chrome/installer/linux/common/desktop.template
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+Name=@@MENUNAME@@
+Comment=@@SHORTDESC@@
+Exec=@@INSTALLDIR@@/@@PACKAGE@@
+Terminal=false
+Icon=@@INSTALLDIR@@/@@PACKAGE@@.png
+Type=Application
+Categories=Application;Network;
diff --git a/chrome/installer/linux/common/updater b/chrome/installer/linux/common/updater
new file mode 100755
index 0000000..53a8a80
--- /dev/null
+++ b/chrome/installer/linux/common/updater
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# TODO
+# - handle other distros (e.g. non-apt).
+
+@@include@@apt.include
+
+if [ -x "$APT_GET" ]; then
+ update_sources_lists
+ # If the repo was just added, force a cache update.
+ if [ $? -eq 1 ]; then
+ install_key
+ "$APT_GET" -qq update
+ fi
+
+ # TODO(mmoss) detect if apt cache is stale (> 1 day) and force update?
+
+ # Just try to install the packge. If it's already installed, apt-get won't do
+ # anything.
+ "$APT_GET" install -y -q @@PACKAGE@@
+fi
+
diff --git a/chrome/installer/linux/common/wrapper b/chrome/installer/linux/common/wrapper
new file mode 100644
index 0000000..35b3b8e
--- /dev/null
+++ b/chrome/installer/linux/common/wrapper
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+PROGDIR=$(dirname $(readlink -f $0))
+export LD_LIBRARY_PATH=$PROGDIR:$LD_LIBRARY_PATH
+exec "$PROGDIR/@@PROGNAME@@" "$@"
diff --git a/chrome/installer/linux/debian/build.sh b/chrome/installer/linux/debian/build.sh
new file mode 100755
index 0000000..078c67c
--- /dev/null
+++ b/chrome/installer/linux/debian/build.sh
@@ -0,0 +1,310 @@
+#!/bin/bash
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# TODO
+# - only package opt builds?
+
+set -e
+if [ "$VERBOSE" ]; then
+ set -x
+fi
+
+# Recursively replace @@include@@ template variables with the referenced file,
+# and write the resulting text to stdout.
+process_template_includes() {
+ INCSTACK+="$1->"
+ # Includes are relative to the file that does the include.
+ INCDIR=$(dirname $1)
+ # Clear IFS so 'read' doesn't trim whitespace
+ local OLDIFS="$IFS"
+ IFS=''
+ while read -r LINE
+ do
+ INCLINE=$(sed -e '/@@include@@/!d' <<<$LINE)
+ if [ -n "$INCLINE" ]; then
+ INCFILE=$(echo $INCLINE | sed -e "s#@@include@@\(.*\)#\1#")
+ # Simple filename match to detect cyclic includes.
+ CYCLE=$(sed -e "\#$INCFILE#"'!d' <<<$INCSTACK)
+ if [ "$CYCLE" ]; then
+ echo "ERROR: Possible cyclic include detected." 1>&2
+ echo "$INCSTACK$INCFILE" 1>&2
+ exit 1
+ fi
+ process_template_includes "$INCDIR/$INCFILE"
+ else
+ echo "$LINE"
+ fi
+ done < "$1"
+ IFS="$OLDIFS"
+ INCSTACK=${INCSTACK%"$1->"}
+}
+
+# Replace template variables (@@VARNAME@@) in the given template file. If a
+# second argument is given, save the processed text to that filename, otherwise
+# modify the template file in place.
+process_template() {
+ local TMPLIN="$1"
+ if [ -z "$2" ]; then
+ local TMPLOUT="$TMPLIN"
+ else
+ local TMPLOUT="$2"
+ fi
+ # Process includes first so included text also gets substitutions.
+ TMPLINCL="$(process_template_includes "$TMPLIN")"
+ sed \
+ -e "s#@@PACKAGE@@#${PACKAGE}#g" \
+ -e "s#@@PROGNAME@@#${PROGNAME}#g" \
+ -e "s#@@VERSION@@#${VERSIONFULL}#g" \
+ -e "s#@@INSTALLDIR@@#${INSTALLDIR}#g" \
+ -e "s#@@MENUNAME@@#${MENUNAME}#g" \
+ -e "s#@@DEPENDS@@#${DEB_DEPS}#g" \
+ -e "s#@@PROVIDES@@#${DEB_PROVIDES}#g" \
+ -e "s#@@REPLACES@@#${DEB_REPLACES}#g" \
+ -e "s#@@CONFLICTS@@#${DEB_CONFLICTS}#g" \
+ -e "s#@@ARCHITECTURE@@#${DEB_HOST_ARCH}#g" \
+ -e "s#@@DEBFULLNAME@@#${DEBFULLNAME}#g" \
+ -e "s#@@DEBEMAIL@@#${DEBEMAIL}#g" \
+ -e "s#@@REPOCONFIG@@#${REPOCONFIG}#g" \
+ -e "s#@@SHORTDESC@@#${SHORTDESC}#g" \
+ -e "s#@@FULLDESC@@#${FULLDESC}#g" \
+ > "$TMPLOUT" <<< "$TMPLINCL"
+}
+
+# Create the Debian changelog file needed by dpkg-gencontrol. This just adds a
+# placeholder change, indicating it is the result of an automatic build.
+# TODO(mmoss) Release packages should create something meaningful for a
+# changelog, but simply grabbing the actual 'svn log' is way too verbose. Do we
+# have any type of "significant/visible changes" log that we could use for this?
+gen_changelog() {
+ rm -f "${CHANGELOG}"
+ process_template changelog.template "${CHANGELOG}"
+ debchange -a --nomultimaint -m --changelog "${CHANGELOG}" \
+ --distribution UNRELEASED "automatic build"
+}
+
+# Create the Debian control file needed by dpkg-deb.
+gen_control() {
+ dpkg-gencontrol -v"${VERSIONFULL}" -ccontrol -l"${CHANGELOG}" -ffiles \
+ -p"${PACKAGE}" -P"${STAGEDIR}" -O > "${STAGEDIR}/DEBIAN/control"
+ rm -f control
+}
+
+# Setup the installation directory hierachy in the package staging area.
+prep_staging() {
+ install -m 755 -d "${STAGEDIR}/DEBIAN" \
+ "${STAGEDIR}${INSTALLDIR}" \
+ "${STAGEDIR}/${INSTALLDIR}/locales" \
+ "${STAGEDIR}/${INSTALLDIR}/themes" \
+ "${STAGEDIR}/usr/bin"
+}
+
+# Put the package contents in the staging area.
+stage_install() {
+ echo "Staging install files in '${STAGEDIR}'..."
+ # TODO(mmoss) This assumes we built the static binaries. To support shared
+ # builds, we probably want an install target in scons so it can give us all
+ # the right files. See also:
+ # http://code.google.com/p/chromium/issues/detail?id=4451
+ install -m 755 -s "${BUILDDIR}/${PROGNAME}" "${STAGEDIR}${INSTALLDIR}/"
+ install -m 644 "${BUILDDIR}/${PROGNAME}.pak" "${STAGEDIR}${INSTALLDIR}/"
+ install -m 644 "${BUILDDIR}/locales/en-US.pak" \
+ "${STAGEDIR}${INSTALLDIR}/locales/"
+ install -m 644 "${BUILDDIR}/themes/default.pak" \
+ "${STAGEDIR}${INSTALLDIR}/themes/"
+ install -m 644 "${BUILDDIR}/icudt38l.dat" "${STAGEDIR}${INSTALLDIR}/"
+ install -m 644 "../common/${PACKAGE}/${PACKAGE}.png" \
+ "${STAGEDIR}${INSTALLDIR}/"
+ process_template "../common/wrapper" "${STAGEDIR}${INSTALLDIR}/${PACKAGE}"
+ chmod 755 "${STAGEDIR}${INSTALLDIR}/${PACKAGE}"
+ (cd "${STAGEDIR}/usr/bin/" && ln -snf "${INSTALLDIR}/${PACKAGE}" "${PACKAGE}")
+ process_template "../common/desktop.template" \
+ "${STAGEDIR}${INSTALLDIR}/${PACKAGE}.desktop"
+ chmod 644 "${STAGEDIR}${INSTALLDIR}/${PACKAGE}.desktop"
+ process_template postinst "${STAGEDIR}/DEBIAN/postinst"
+ chmod 755 "${STAGEDIR}/DEBIAN/postinst"
+ process_template prerm "${STAGEDIR}/DEBIAN/prerm"
+ chmod 755 "${STAGEDIR}/DEBIAN/prerm"
+ # TODO(mmoss) For dogfooding, we already have daily updates of all installed
+ # packages. Externally, we'll have to implement something if we don't want to
+ # rely exclusively on the system updater (the default configuration is often
+ # not forced/silent).
+ #process_template "../common/updater" \
+ # "${STAGEDIR}/etc/cron.daily/${PACKAGE}-updater"
+ #chmod 755 "${STAGEDIR}/etc/cron.daily/${PACKAGE}-updater"
+}
+
+# Put the 32-bit compatability libraries in the staging area. This is a
+# workaround for missing libs on 64-bit Ubuntu.
+# https://bugs.launchpad.net/ubuntu/+source/ia32-libs/+bug/326311
+# https://bugs.launchpad.net/ubuntu/+source/ia32-libs/+bug/246911
+grab_lib32() {
+ echo "Copying 32-bit libs..."
+ local SYSLIBS="
+ /usr/lib32/libsqlite3.so.0
+ /usr/lib32/libsqlite3.so.0.8.6
+ /usr/lib32/libnspr4.so.0d
+ /usr/lib32/libplds4.so.0d
+ /usr/lib32/libplc4.so.0d
+ /usr/lib32/libssl3.so.1d
+ /usr/lib32/libnss3.so.1d
+ /usr/lib32/libsmime3.so.1d
+ /usr/lib32/libnssutil3.so.1d
+ /usr/lib32/nss/libfreebl3.so
+ /usr/lib32/nss/libsoftokn3.chk
+ /usr/lib32/nss/libsoftokn3.so
+ /usr/lib32/nss/libnssckbi.so
+ /usr/lib32/nss/libnssdbm3.so
+ /usr/lib32/nss/libfreebl3.chk
+ "
+ for lib in $SYSLIBS; do
+ if [ -h "$lib" ]; then
+ cp -P "$lib" "${STAGEDIR}${INSTALLDIR}/"
+ else
+ install "$lib" "${STAGEDIR}${INSTALLDIR}/"
+ fi
+ done
+}
+
+# Prepare and create the 32-bit package.
+package_32() {
+ export DEB_HOST_ARCH=i386
+ echo "Packaging ${DEB_HOST_ARCH}..."
+ DEB_DEPS="libc6 (>= 2.6-1), libnss3-1d, libatk1.0-0 (>= 1.13.2), \
+ libcairo2 (>=1.4.0), libfontconfig1 (>= 2.4.0), libfreetype6 (>= 2.3.5), \
+ libgcc1 (>= 1:4.2.1), libglib2.0-0 (>= 2.14.0), libgtk2.0-0 (>= 2.12.0), \
+ libnspr4-0d (>= 1.8.0.10), libpango1.0-0 (>= 1.18.3), \
+ libstdc++6 (>= 4.2.1), zlib1g (>= 1:1.2.3.3.dfsg-1), ${COMMON_DEPS}"
+ gen_changelog
+ process_template control.template control
+ do_package
+}
+
+# Prepare and create the 64-bit package.
+package_64() {
+ export DEB_HOST_ARCH=amd64
+ echo "Packaging ${DEB_HOST_ARCH}..."
+ DEB_DEPS="ia32-libs (>= 1.6), lib32gcc1 (>= 1:4.1.1), \
+ lib32stdc++6 (>= 4.1.1), lib32z1 (>= 1:1.1.4), libc6-i386 (>= 2.4), \
+ ${COMMON_DEPS}"
+ gen_changelog
+ grab_lib32
+ process_template control.template control
+ do_package
+}
+
+# Prepare and create the 64-bit package without 32-bit compat libs.
+package_split_64() {
+ export DEB_HOST_ARCH=amd64
+ # ia32-libs should eventually provide all the missing 32-bit libs, so when it
+ # does, we can rewrite the compat-lib32 dep as:
+ # ia32-libs (>= 2.7ubuntuXYZ) | chromium-compat-lib32
+ # This will allow either ia32-libs or our package to provide the 32-bit libs,
+ # depending on the platform.
+ # Note that this won't replace the current ia32-libs dep because we still need
+ # at least that version for other dependencies, like libgtk.
+ DEB_DEPS="chromium-compat-lib32, \
+ ia32-libs (>= 1.6), lib32gcc1 (>= 1:4.1.1), lib32stdc++6 (>= 4.1.1), \
+ lib32z1 (>= 1:1.1.4), libc6-i386 (>= 2.4), ${COMMON_DEPS}"
+ DEB_REPLACES="${PACKAGE}"
+ DEB_CONFLICTS="${PACKAGE}"
+ process_template control.template control
+ do_package
+}
+
+# Prepare and create the package of 32-bit library dependencies.
+package_compat_libs() {
+ cleanup
+ export DEB_HOST_ARCH=amd64
+ PACKAGE="chromium-compat-lib32"
+ echo "Packaging ${PACKAGE}..."
+ SHORTDESC="32-bit compatibility libs for Chromium browser."
+ FULLDESC="32-bit libs needed by the Chromium web browser, which are not \
+ provided by ia32-libs on Hardy."
+ DEB_DEPS=""
+ DEB_PROVIDES=""
+ DEB_REPLACES="chromium-compat-lib32"
+ DEB_CONFLICTS="chromium-compat-lib32"
+ gen_changelog
+ install -m 755 -d "${STAGEDIR}/DEBIAN" "${STAGEDIR}${INSTALLDIR}"
+ grab_lib32
+ process_template control.template control
+ do_package
+}
+
+
+# Actually generate the package file.
+do_package() {
+ if [ -f control ]; then
+ gen_control
+ fi
+ fakeroot dpkg-deb -b "${STAGEDIR}" .
+}
+
+# Remove temporary files and unwanted packaging output.
+cleanup() {
+ echo "Cleaning..."
+ rm -rf "${STAGEDIR}"
+ rm -f "${CHANGELOG}"
+ rm -f files
+ rm -f control
+}
+
+#=========
+# MAIN
+#=========
+
+BUILDDIR=../../../Hammer
+STAGEDIR=build
+CHANGELOG=changelog.auto
+cleanup
+
+if [ "$1" = "release" ]; then
+ source ../common/google-chrome/google-chrome.info
+else
+ source ../common/chromium-browser/chromium-browser.info
+fi
+# Some Debian packaging tools want these set.
+export DEBFULLNAME="${MAINTNAME}"
+export DEBEMAIL="${MAINTMAIL}"
+get_versioninfo
+
+prep_staging
+stage_install
+COMMON_DEPS="msttcorefonts, xdg-utils (>= 1.0.1)"
+package_32
+package_64
+
+# TODO(mmoss) At some point we might want to separate the 32-bit compatibility
+# libs into a separate package, to decrease the download size for distros that
+# don't need the additional libs, and to make sure we're using the updated
+# system libs if available (i.e. once Ubuntu bug
+# https://bugs.launchpad.net/ubuntu/+source/ia32-libs/+bug/326311 is fixed).
+#
+# The problem is we also want to provide a "one-click" install, which means the
+# first installed package (as created above) has to have everything it needs,
+# since we can't assume people have our repository configured to download
+# additional packages from us to satisfy dependencies. Unfortunately, creating
+# such a "monolithic" package for the first install breaks the ability to rely
+# on the system's package manager for autoupdates. This is because we would be
+# trying to update the monolithic package with the split packages, but the split
+# browser package adds a dependency on the split library package, and 'apt-get
+# upgrade' refuses to upgrade a package to a newer version if the dependency
+# list has changed. For that you need 'apt-get dist-upgrade', which is not
+# appropriate for daily updates, or an explicit 'apt-get install <package>',
+# which we might be able to do if we use a custom auto-update script, but that
+# is still to be decided for post-dogfood.
+#
+# For now, the safest bet is to use the monolithic package for everything, maybe
+# even until the next Ubuntu LTS release with (hopefully) fixed ia32.
+#
+# Note that it's not sufficient to add the library dependency and a faux
+# "Provides" to the monolithic package, since apt-get seems to be smart enough
+# to negate those out, and thus still considers the dependency lists to be
+# different.
+#package_split_64
+#package_compat_libs
+
+cleanup
diff --git a/chrome/installer/linux/debian/changelog.template b/chrome/installer/linux/debian/changelog.template
new file mode 100644
index 0000000..70492de
--- /dev/null
+++ b/chrome/installer/linux/debian/changelog.template
@@ -0,0 +1,4 @@
+@@PACKAGE@@ (@@VERSION@@) UNRELEASED; urgency=low
+
+
+ -- @@DEBFULLNAME@@ <@@DEBEMAIL@@> Tue, 03 Feb 2009 14:54:35 -0800
diff --git a/chrome/installer/linux/debian/control.template b/chrome/installer/linux/debian/control.template
new file mode 100644
index 0000000..422e7e2
--- /dev/null
+++ b/chrome/installer/linux/debian/control.template
@@ -0,0 +1,15 @@
+Source: @@PACKAGE@@
+Section: net
+Priority: optional
+Maintainer: @@DEBFULLNAME@@ <@@DEBEMAIL@@>
+Build-Depends: fakeroot, dpkg-dev, devscripts
+Standards-Version: 3.8.0
+
+Package: @@PACKAGE@@
+Provides: @@PROVIDES@@
+Replaces: @@REPLACES@@
+Conflicts: @@CONFLICTS@@
+Depends: @@DEPENDS@@
+Architecture: @@ARCHITECTURE@@
+Description: @@SHORTDESC@@
+ @@FULLDESC@@
diff --git a/chrome/installer/linux/debian/postinst b/chrome/installer/linux/debian/postinst
new file mode 100755
index 0000000..0fe0a51
--- /dev/null
+++ b/chrome/installer/linux/debian/postinst
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Add icon to the system menu
+XDG_DESKTOP_MENU="`which xdg-desktop-menu 2> /dev/null`"
+UPDATE_MENUS="`which update-menus 2> /dev/null`"
+if [ ! -x "$XDG_DESKTOP_MENU" ]; then
+ echo "Error: Could not find xdg-desktop-menu" >&2
+ exit 1
+fi
+"$XDG_DESKTOP_MENU" install @@INSTALLDIR@@/@@PACKAGE@@.desktop
+
+if [ -x "$UPDATE_MENUS" ]; then
+ update-menus
+fi
+
+
+# Make sure the Google repository is configured for updating.
+@@include@@../common/apt.include
+
+if [ -x "$APT_GET" ]; then
+ update_sources_lists
+ # If the repo was just added, force a cache update.
+ if [ $? -eq 1 ]; then
+ install_key
+ # apt-get from a package install is sketchy, so spawn a script to run it
+ # later and keep trying for up to a day.
+ TMPFILE=$(mktemp -q -t @@PACKAGE@@-XXXX)
+ if [ $? -ne 0 ]; then
+ # Not currently worried about error because this update isn't critical
+ # and it shouldn't cause the install to fail.
+ exit 0
+ fi
+ TOMORROW=$(date "+%s" -d "now +1 day" 2>/dev/null || echo 0)
+ cat >"$TMPFILE" <<EOF
+#!/bin/sh
+set -e
+sleep 10
+ENDTIME=$TOMORROW
+while [ \$ENDTIME -gt \$(date "+%s" -d "now") ]; do
+ $APT_GET -qq update
+ if [ \$? -eq 0 ]; then
+ break
+ fi
+ sleep 120
+done
+rm \$0
+EOF
+ (sh "$TMPFILE") &
+ fi
+fi
diff --git a/chrome/installer/linux/debian/prerm b/chrome/installer/linux/debian/prerm
new file mode 100755
index 0000000..1cbef42
--- /dev/null
+++ b/chrome/installer/linux/debian/prerm
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Remove icon from the system menu
+XDG_DESKTOP_MENU="`which xdg-desktop-menu 2> /dev/null`"
+UPDATE_MENUS="`which update-menus 2> /dev/null`"
+if [ ! -x "$XDG_DESKTOP_MENU" ]; then
+ echo "Error: Could not find xdg-desktop-menu" >&2
+ exit 1
+fi
+"$XDG_DESKTOP_MENU" uninstall @@INSTALLDIR@@/@@PACKAGE@@.desktop
+
+if [ -x "$UPDATE_MENUS" ]; then
+ update-menus
+fi