public
Created

Shell script for pulling the latest Conkeror from git and building it.

  • Download Gist
Info.plist.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
--- 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>
update_conkeror
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
#!/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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.