openbsd-ports/mail/enigmail-seamonkey/files/regchrome
martynas 28b98c677c import enigmail-seamonkey-0.95.6
Enigmail is an extension to the mail client of Mozilla/Netscape and
Mozilla Thunderbird which allows users to access the authentication
and encryption features provided by GnuPG.

This port is similar to enigmail, but is built for seamonkey.
Importing new port, instead of adding quirks to existing port, was
a much simplier solution this time.

regxpcom is an awk script, that takes care of maintaining
installed-chromes.txt.
go ahead, and a tweak from bernd@.  kurt@ agrees.
2008-07-22 19:42:11 +00:00

51 lines
1.1 KiB
Bash

#!/bin/sh
# $OpenBSD: regchrome,v 1.1.1.1 2008/07/22 19:42:11 martynas Exp $
# Generate installed-chrome.txt entries for Enigmail
if [ $# -ne 3 ]; then
echo "usage: $0 [install.js] [installed-chrome.txt] [install|uninstall]"
exit 1
fi
if [ "$3" = "uninstall" ]; then
TMPFILE1=`mktemp -t genchrome.XXXXXXXXXX`
if [ $? -ne 0 ]; then
print "$0: mktemp failed"
exit 1
fi
TMPFILE2=`mktemp -t genchrome.XXXXXXXXXX`
if [ $? -ne 0 ]; then
print "$0: mktemp failed"
exit 1
fi
cp "$2" "$TMPFILE1"
fi
grep registerChrome "$1" |
grep -v "tbird" |
awk -F'"' '{
pat = "install,url,jar:resource:/chrome"
split($6, tok, "/")
if (tok[1] == "content") {
printf("skin,%s/%s!/%s\n", pat, $4, $6)
printf("locale,%s/%s!/%s\n", pat, $4, $6)
}
printf("%s,%s/%s!/%s\n", tok[1], pat, $4, $6)
}' |
while read line; do
if [ "$3" = "install" ]; then
fgrep "$line" "$2" > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "$line" >> "$2"
fi
fi
if [ "$3" = "uninstall" ]; then
fgrep -v "$line" "$TMPFILE1" > "$TMPFILE2" 2>/dev/null
mv "$TMPFILE2" "$TMPFILE1"
fi
done
if [ "$3" = "uninstall" ]; then
mv "$TMPFILE1" "$2"
fi