Skip to content

Instantly share code, notes, and snippets.

@figital
Forked from cowboy/chromiumer-devtools.sh
Created July 25, 2011 15:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save figital/1104420 to your computer and use it in GitHub Desktop.
Save figital/1104420 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` */
body.platform-mac.platform-mac-snowleopard .monospace,
body.platform-mac.platform-mac-snowleopard .source-code {
font-size: 18px !important;
font-family: monaco, monospace;
}
body.platform-linux .monospace, body.platform-linux .source-code {
font-size: 18px !important;
font-family: dejavu sans mono, monospace;
}
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!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment