Skip to content

Instantly share code, notes, and snippets.

@marek-saji
Created July 25, 2014 13:24
Show Gist options
  • Save marek-saji/a9483225edece9dd79ac to your computer and use it in GitHub Desktop.
Save marek-saji/a9483225edece9dd79ac to your computer and use it in GitHub Desktop.
Script (may be used in cron) for downloading freach chromium build
--- chrome-linux/chrome-wrapper 2013-10-08 10:17:28.000000000 +0200
+++ chrome-linux/chrome-wrapper 2013-10-08 20:32:38.927865329 +0200
@@ -27,7 +27,7 @@
for dir in $search; do
unset IFS
[ "$dir" -a -d "$dir/applications" ] || continue
- [ -r "$dir/applications/$DESKTOP.desktop" ] && return
+ [ -n "$( find -L "$dir/applications/" -name "$DESKTOP.desktop" )" ] && return
done
# Didn't find it in the search path.
return 1
@@ -160,4 +160,4 @@
done
set -- "${ARGS[@]}" "$@"
-exec $CMD_PREFIX "$HERE/chrome" "$@"
+CHROME_DEVEL_SANDBOX="$HERE/chrome_sandbox" exec $CMD_PREFIX "$HERE/chrome" "$@"
#!/bin/bash
# Use X, if available
#DISPLAY=$( ps -p `pidof X` -o cmd= | grep -P -o ':[0-9]+(?:\.[0-9]+|)' | head -n1 )
if [ -z "$DISPLAY" ] || [ -z "$DBUS_SESSION_BUS_ADDRESS" ]
then
# Load DBUS session
eval $( grep -Ez '^DBUS_SESSION_BUS_ADDRESS|^DISPLAY' /proc/$( pgrep -u $USER dbus-daemon | tail -n1 )/environ | xargs -0 printf "%s\n" )
fi
error ()
{
notify-send \
--icon=error \
-- 'Chromium dev' "$*" || :
echo "ERROR" "$@"
exit 1
}
info ()
{
notify-send \
--icon=info \
--hint=int:transient:1 \
-- 'Chromium dev' "$*" || :
tty -s && echo "INFO" "$@" || :
}
errtrap ()
{
error "Command failed: ${BASH_COMMAND}"
}
trap errtrap ERR
set -o errexit
# get display
if [ -z "$DISPLAY" ]
then
DISPLAY="$( ps -p `pidof X` -o cmd= | grep -P -o ':[0-9]+(?:\.[0-9]+|)' | head -n1 )"
fi
OUTDIR=~saji/local/opt/chromium-dev/
TMPDIR=~saji/local/opt/chromium-dev-tmp/
rm -rf $TMPDIR/chrome-linux
test -d $TMPDIR || mkdir $TMPDIR
info 'Downloading new version'
cd "$TMPDIR"
wget $( tty -s || echo '--quiet' ) http://download-chromium.appspot.com/dl/Linux_x64 -O chromium.zip
unzip $( tty -s || echo '-q' ) chromium.zip
ln -s /opt/google/chrome/libudev.so.0 chrome-linux/
sudo chown root:root chrome-linux/chrome_sandbox
sudo chmod 4755 chrome-linux/chrome_sandbox
patch -s -d chrome-linux/ < "$OUTDIR/chrome-wrapper.patch"
rm -rf "$OUTDIR/chrome-linux"
mv -f "$TMPDIR/chrome-linux" "$OUTDIR"
cd
rm -rf "$TMPDIR"
if "$OUTDIR/chrome-linux/chrome-wrapper" --version 2>&1 > /dev/null
then
VERSION="$( "$OUTDIR/chrome-linux/chrome-wrapper" --version)"
info "New version: $VERSION"
else
error "$( "$OUTDIR/chrome-linux/chrome-wrapper" --version 2>&1 )"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment