-
Notifications
You must be signed in to change notification settings - Fork 116
/
kitfox-patch
executable file
·82 lines (63 loc) · 2.55 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
72
73
74
75
76
77
78
79
80
81
82
#!/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.
# On a system where firefox is installed as a package, pass it the
# location of the firefox files, e.g. /usr/lib/firefox on Debian/Ubuntu.
# 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
echo "Pass location of firefox files, e.g. /usr/lib/firefox"
exit 1
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
realomni=$FIREFOXDIR/browser/omni.ja
OMNITMPDIR=/tmp/omni
# BACKUP_OMNI=$FIREFOXDIR/browser-omni-backup.ja
BACKUP_OMNI=$HOME/browser-omni-backup-$(date +%Y-%m-%d).ja
echo "Making directory $OMNITMPDIR ..."
mkdir $OMNITMPDIR
cd $OMNITMPDIR
echo "Unzipping in $OMNITMPDIR ..."
unzip -q $realomni
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
# browser.xul got renamed to browser.xhtml in Firefox 69.0:
sed -i '/key_close/s/ reserved="true"//' chrome/browser/content/browser/browser.xhtml
# End of patches
########################################
echo "Repackaging ..."
# repackage omni.ja:
zip -qr9XD /tmp/newomni.ja *
echo "Backing up original to $BACKUP_OMNI"
cp $FIREFOXDIR/browser/omni.ja $BACKUP_OMNI
echo "Trying to copy /tmp/newomni.ja to $realomni"
echo "If this doesn't work, try sudo cp /tmp/newomni.ja $realomni"
echo
cp /tmp/newomni.ja $realomni && echo "Copied new omni.ja into $realomni"