Skip to content

Instantly share code, notes, and snippets.

@cowboy
Created July 19, 2011 19:25
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cowboy/1093476 to your computer and use it in GitHub Desktop.
Save cowboy/1093476 to your computer and use it in GitHub Desktop.
chromiumer.sh bash script that will download the latest Chromium chrome-mac.zip and devtools_frontend.zip, extract them into cwd, and link them together using --debug-devtools-frontend.
#!/bin/bash
# I use this (optional) file to make the font larger for presentations - Cowboy
echo -n "Modifying fonts..."
find "$1" \( -name devTools.css \) \
-exec sh -c 'cat >> $1 <<EOF
/* === Added on `date` === */
/* LARGER fonts in WebKit Inspector */
/* Yes, this is intentional (selector specificity, etc) */
body[class*="platform-"][class*="platform-"] .monospace,
body[class*="platform-"][class*="platform-"] .source-code,
.console-group-messages .outline-disclosure,
.console-group-messages .outline-disclosure ol {
font-size: 20px !important;
line-height: 1.15em !important;
}
.styles-element-state-pane { margin-top: -53px !important; }
.styles-element-state-pane.expanded { margin-top: 0 !important; }
.section .header::before { top: -5px !important; }
.section {
margin-top: 0.3em !important;
margin-bottom: 0.5em !important;
}
EOF' _ {} \;
echo "OK"
#!/bin/bash
OS="Mac"
URLBASE="http://commondatastorage.googleapis.com/chromium-browser-continuous/$OS"
APP="chrome-mac.zip"
DEV="devtools_frontend.zip"
REV=$1
INSTALLPATH="."
CURRENT=$(cat "$INSTALLPATH/chromium/REVISION" 2>/dev/null)
if [ ! "$REV" ]; then
echo -n "Checking latest Chromium version..."
REV=$(curl -s "$URLBASE/LAST_CHANGE")
if [[ "$REV" =~ ^[0-9]+$ ]]; then
echo "OK"
else
echo "ERROR"
echo "Error loading revision data from $URLBASE/LAST_CHANGE, aborting update."
exit 1
fi
fi
echo "Attempting to update Chromium to revision $REV..."
if [ "$REV" = "$CURRENT" ]; then
if [ "$1" ]; then
echo "Revision $REV is already installed!"
else
echo "Already up-to-date!"
fi
exit 1
fi
TMP=$(mktemp -d "/tmp/chromiumer.XXXXX")
curl "$URLBASE/$REV/{$APP,$DEV}" --progress-bar --location --output "$TMP/#1"
if [ ! -f "$TMP/$APP" ]; then
echo "Error downloading $APP, aborting update."
rm -rf "$TMP"
exit 1
fi
if [ ! -f "$TMP/$DEV" ]; then
echo "Error downloading $DEV, aborting update."
rm -rf "$TMP"
exit 1
fi
echo -n "Deleting existing files..."
rm -rf "$INSTALLPATH/Chromium.app" "$INSTALLPATH/chromium"
echo "OK"
echo -n "Creating new files..."
mkdir -p "$INSTALLPATH/chromium"
DEVTOOLS="$INSTALLPATH/chromium/devtools"
echo $REV > "$INSTALLPATH/chromium/REVISION"
unzip -qo "$TMP/$DEV" -d "$DEVTOOLS"
unzip -qo "$TMP/$APP" -d "$TMP"
echo "OK"
APPBASE=$(basename "$APP" .zip)
mv "$TMP/$APPBASE/Chromium.app" "$INSTALLPATH/"
echo -n "Modifying Chromium bin file to use --debug-devtools-frontend..."
BINPATH="$INSTALLPATH/Chromium.app/Contents/MacOS"
BIN="$BINPATH/Chromium"
mv "$BIN" "$BINPATH/Chromium-bin"
cat > "$BIN" <<'EOF'
#!/bin/bash
BIN=$(echo $0 | perl -pe 's/$/-bin/')
DEV=$(echo $0 | perl -pe 's#Chromium\.app.*#chromium/devtools#')
"$BIN" --debug-devtools-frontend="$DEV"
EOF
chmod +x "$BIN"
echo "OK"
echo -n "Cleaning up..."
rm -rf "$TMP"
echo "OK"
if [ -f "chromiumer-devtools.sh" ]; then
echo "Running chromiumer-devtools.sh..."
./chromiumer-devtools.sh "$DEVTOOLS"
fi
echo "Done!"
@mathiasbynens
Copy link

In case anyone wants this as an app, just appify it!

@karuppasamy
Copy link

OH!! Sorry I'm using Linux Fedora Core 8 version. Can you please give me the script for Linux (Fedora core 8)?. Thanks.

@cowboy
Copy link
Author

cowboy commented Jan 2, 2012

This has now been rolled into my dotfiles repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment