Skip to content

Bundling Google Chrome

probonopd edited this page Feb 11, 2017 · 15 revisions

This is the script I use to bundle Google Chrome. Run on debian or Ubuntu or another deb-based distribution:

mkdir -p chrome/chrome.AppDir/usr/lib
cd chrome
cp /usr/lib/x86_64-linux-gnu/libXss.so.1 chrome.AppDir/usr/lib/
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
cd chrome.AppDir/

find ../ -name *.deb -exec dpkg -x \{\} . \;

find . -name *.desktop -exec cp \{\} . \;

find -name product_logo_48.png -exec cp \{\} google-chrome.png \;

cd usr/bin/
ln -sf ../../opt/google/chrome/google-chrome ./google-chrome-stable
cd -

cp /lib/x86_64-linux-gnu/libudev.so.1.*.* usr/lib/libudev.so.0

sed -i -e 's|/usr/bin/google-chrome-stable %U|AppRun|g' google-chrome.desktop

cat > ./AppRun <<\EOF
#!/bin/sh
HERE=$(dirname $(readlink -f "${0}"))
export LD_LIBRARY_PATH="${HERE}"/usr/lib:$PATH
"${HERE}"/usr/bin/google-chrome-stable $@
EOF
chmod a+x ./AppRun

# Try to run ./AppRun

cd ..

VERSION=$(strings chrome.AppDir/opt/google/chrome/chrome | grep Chrome_Linux -C 1 | grep ^[0-9\.]+* | head -n 1)
wget -c "https://github.com/probonopd/AppImageKit/releases/download/knowngood/appimagetool-x86_64.AppImage"
chmod a+x appimagetool-x86_64.AppImage 
VERSION=$VERSION ./appimagetool-x86_64.AppImage chrome.AppDir/