Skip to content

Instantly share code, notes, and snippets.

@richlanc
Last active April 27, 2017 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richlanc/1ad4cceff3441f1c96d74dadf8135c72 to your computer and use it in GitHub Desktop.
Save richlanc/1ad4cceff3441f1c96d74dadf8135c72 to your computer and use it in GitHub Desktop.
Ubuntu Chrome on CentOS hack
# Prepare ubuntu chroot with google-chrome
debootstrap --arch=amd64 ${ubuntu_version} ${_tmppath}/ubuntu/ http://archive.ubuntu.com/ubuntu/
cp /etc/resolve.conf ${_tmppath}/ubuntu/etc/resolve.conf
VERSION=${ubuntu_version} envsubst <${SOURCES}/sources.list.env >${_tmppath}/ubuntu/etc/apt/sources.list
chroot ${_tmppath}/ubuntu/ /bin/sh <<EOF
# Install chrome
apt-get update && apt-get -y install wget
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-get add-key -
apt-get update
apt-get -y install google-chrome-stable
# Save Ubuntu's LD paths to a file
ldconfig -v 2>&1 | grep -v $'\t' | egrep -e '^/' | sed -E 's,:.*$,,' > /ld_paths
EOF
# Update the ld_paths
sed -iE 's,^,/sv/svChrome,; :a;N;$!ba;s/\n/:/g; s,^,LD_LIBRARY_PATH=,' ${_tmppath}/ubuntu/ld_paths
cp ${_tmppath}/ubuntu/ld_paths ${BUILDPATH}/
# Copy libraries and chrome
while read ubuntu_path
do
cp -r "${_tmppath}${ubuntu_path}" "${BUILDPATH}"
done < ${_tmppath}/ubuntu/LD_PATHS
cp -r "${_tmppath}/opt/" "${BUILDPATH}"
# Patch chrome binary, can't use CentOS's linker
patchelf --set-interpreter "${BUILDPATH}/opt/google/chrome/chrome" "/sv/svChrome/lib64/ld-linux-x86-64.so.2"
# Fix symlink, not sure where it is atm
ln -sf something something
cat >"${BUILDPATH}/ubuntuenv" <<EOF
#!/bin/bash
. /sv/svChrome/ld_paths; exec "$@"
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment