Create a gist now

Instantly share code, notes, and snippets.

Shell script for pulling the latest Conkeror from git and building it.
--- Contents/Info.plist 2012-02-17 06:47:35.000000000 +0000
+++ foo/Info.plist 2012-02-15 14:02:14.000000000 +0000
@@ -2,6 +2,32 @@
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>CFBundleSignature</key>
+ <string>CNKR</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.mozdev.conkeror</string>
+ <key>CFBundleURLTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleURLName</key>
+ <string>Web site URL</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>http</string>
+ <string>https</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleURLName</key>
+ <string>Local file URL</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>file</string>
+ </array>
+ </dict>
+ </array>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
#!/usr/bin/env bash
# Usage: update_conkeror [checkout_dir]
# $1: (optional) source code destination.
# Default: ~/Applications/conkeror (Mac), ~/binaries/conkeror (else)
# Prerequisites:
# - PAGER env var set and/or 'more' installed
# - TMPDIR env var set and/or ~/tmp dir exists, for temp file creation. Also, on
# OS X the previous app bundle will be backed up here before the new one is
# built.
# - Xulrunner installed
# - (OS X) ~/Info.plist.patch, to enable setting Conkeror as default browser etc
# - (Non-OS X) ~/binaries dir exists, or specify checkout_dir on command line
uc__mktemp_gnu () { # $1: mktemp binary name (mktemp or gmktemp) $2: template
"$1" --tmpdir "${2}.XXX"
}
uc__mktemp_bsd () { # $1: template
mktemp -t "$1"
}
uc__mktemp () { # $1: template
case "$OSTYPE" in
[Dd]arwin*|*BSD)
# Do we have the GNU mktemp installed anywhere on PATH?
if [ -x "`which gmktemp`" ] ; then
uc__mktemp_gnu gmktemp $@
else
uc__mktemp_bsd $@
fi
;;
*)
uc__mktemp_gnu mktemp $@
;;
esac
}
# Keep git-merge from going all interactive in git >= 1.7.10
MERGE_AUTO_EDIT=no
case "$OSTYPE" in
[Dd]arwin*)
SRC_DIR="${1:-${HOME}/Applications/conkeror}"
IS_MAC='true'
ECHO='echo -e'
;;
*)
SRC_DIR="${1:-${HOME}/binaries/conkeror}"
IS_MAC=
ECHO='/bin/echo -e'
;;
esac
if [ ! -d "$SRC_DIR" ] ; then
echo "Initial download of Conkeror from the git repo to ${SRC_DIR}..." >&2
mkdir -p "$SRC_DIR" || exit 1
git clone git://repo.or.cz/conkeror.git "$SRC_DIR"
cd "$SRC_DIR" &> /dev/null || exit 1
# One-time setup task
# Support for using eg emacs to edit textarea contents and view source.
echo "Building external editor helper for Conkeror..." >&2
make
echo "Building external editor helper for Conkeror...done." >&2
else
cd "$SRC_DIR" &> /dev/null || exit 1
$ECHO "Fetching...\n" >&2
# Update
git fetch | "${PAGER:-more}"
echo >&2
$ECHO "\nChanges:\n" >&2
# Check changes
CHANGELOG="`uc__mktemp up-co-git-log`"
git log HEAD..origin > "$CHANGELOG"
if [ ! -s "$CHANGELOG" ]; then
echo "None." >&2
exit 0
fi
"${PAGER:-more}" "$CHANGELOG"
echo
echo -n "Press Enter to proceed..."
read ignored
echo
# Merge
git merge origin
echo
echo
fi
if [ ! -z "$IS_MAC" ]; then
# Xulrunner takes a long time to build a double-clickable Mac app bundle
echo "Updating app in background." >&2
(
APP_DIR='/Applications/conkeror.mozdev.org'
# Remove any old backup
rm -Rf "${TMPDIR:-${HOME}/tmp}/conkeror.mozdev.org"
# Backup
mv -f "$APP_DIR" "${TMPDIR:-${HOME}/tmp}/"
/Library/Frameworks/XUL.framework/xulrunner-bin --install-app "$SRC_DIR"
cd "${APP_DIR}/conkeror.app/Contents"
patch --quiet -p1 < "${HOME}/Info.plist.patch"
cd "$APP_DIR"
touch conkeror.app
# 'gn' is my cross-platform wrapper script for growl/snarl/notify-send
#gn 'Updated Conkeror.app to git HEAD.' 'update_conkeror'
) &
else
echo "Updated Conkeror to git HEAD."
echo -n "Press Enter to exit..."
read ignored
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment