forked from akkana/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kitfox-patch
executable file
·71 lines (54 loc) · 2.06 KB
/
kitfox-patch
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
#!/bin/sh
# kitfox: make a customized Firefox.
# Unpack browser/omni.ja, apply patches, then package it back up.
# For more details on the process, see:
# http://shallowsky.com/blog/tech/web/modifying-omni.ja.html
# Either run this from the downloaded and unpacked Firefox directory,
# or pass the path to that directory as the first argument.
# You'll need to re-run this every time Firefox updates browser/omni.ja.
# That doesn't necessarily happen in every Firefox update, but if
# you include a harmless patch to the default URLbar message,
# you can tell when it changes, which will tell you when you need
# to re-run the script. (See "silly message" below.)
FIREFOXDIR=$1
if [ x"$FIREFOXDIR" = "x" ]; then
FIREFOXDIR=$(pwd)
else
# In zsh, $FIREFOXDIR:A would do this.
FIREFOXDIR=$(realpath $FIREFOXDIR)
fi
if [ ! -d "$FIREFOXDIR" ]; then
echo 'Usage: kitfoxpatch [FIREFOXDIR]'
exit 1
fi
echo Firefox dir is $FIREFOXDIR
OMNITMPDIR=/tmp/omni
BACKUP_OMNI=$FIREFOXDIR/browser-omni-backup.ja
echo "Making directory $OMNITMPDIR ..."
mkdir $OMNITMPDIR
cd $OMNITMPDIR
echo "Unzipping in $OMNITMPDIR ..."
unzip -q $FIREFOXDIR/browser/omni.ja
echo "Making changes ..."
########################################
# PUT YOUR DESIRED CHANGE HERE.
# XXX change this to use patch format.
#
# Put a silly message in the URLbar you see on empty tabs.
# The point of this is that when it disappears, you know Firefox
# has updated and you need to re-run this script.
#
sed -i 's/or enter address/or just twiddle your thumbs/' chrome/en-US/locale/browser/browser.dtd chrome/en-US/locale/browser/browser.properties
#
# Get rid of the reserved Ctrl-W bindings in text fields:
#
sed -i '/key_close/s/ reserved="true"//' chrome/browser/content/browser/browser.xul
# End of patches
########################################
echo "Repackaging ..."
# repackage omni.ja:
zip -qr9XD /tmp/newomni.ja *
cp $FIREFOXDIR/browser/omni.ja $BACKUP_OMNI
cp /tmp/newomni.ja $FIREFOXDIR/browser/omni.ja
echo "Copied new omni.ja into $FIREFOXDIR/browser/omni.ja"
echo "Original omni.ja is backed up as $BACKUP_OMNI"