@@ -35,6 +35,24 @@ echo -n '*** uBlock0.safariextension: Adding extensions to extensionless assets.
35
35
find " $DES " /assets/thirdparties -type f -regex ' .*\/[^.]*' -exec mv {} {}.txt \;
36
36
echo ' ✔'
37
37
38
+ echo -n ' *** uBlock0.safariextension: Generating Info.plist...'
39
+ python tools/make-safari-meta.py " $DES " /
40
+ echo ' ✔'
41
+
42
+ # Detect OS for sed arguments
43
+ if [[ " $OSTYPE " == " darwin" * ]]; then
44
+ declare -a sedargs=(' -i' ' ' )
45
+ else
46
+ declare -a sedargs=(' -i' )
47
+ fi
48
+
49
+ # https://github.com/el1t/uBlock-Safari/issues/15
50
+ echo -n ' *** uBlock0.safariextension: Correcting ctrl to ⌘ in messages...'
51
+ for filename in " $DES " /_locales/* .json; do
52
+ sed " ${sedargs[@]} " ' s/Ctrl/⌘/g' " $filename "
53
+ done
54
+ echo ' ✔'
55
+
38
56
# Declare __MSG__ scripts inside client-injected.js
39
57
# Beware: this removes all newlines within each script
40
58
echo -n ' *** uBlock0.safariextension: Injecting scripts into vapi-client...'
@@ -51,28 +69,17 @@ awkscript='BEGIN { p = 0 }
51
69
gsub(/' " '" ' /, "\\' " '" ' ")
52
70
printf "%s", $0
53
71
}'
54
- declare -a sedargs=(' -i' ' ' )
55
72
for message in $( perl -nle ' /^\/\/ (__MSG_[A-Za-z]+__)/ && print $1' < " $DES " /js/client-injected.js) ; do
56
73
script=$( awk " ${awkscript/ __MSG__/ ${message} } " " $DES " /js/client-injected.js | sed ' s/[\"#&]/\\&/g' )
57
74
sedargs+=(' -e' " s#${message} #${script} #" )
58
75
done
59
76
if ! sed " ${sedargs[@]} " " $DES " /js/vapi-client.js 2> /dev/null; then
60
- sed ${sedargs[@]} " $DES " /js/vapi-client.js
77
+ sed " ${sedargs[@]} " " $DES " /js/vapi-client.js
61
78
fi
62
- rm -f $DES /js/client-injected.js
63
- echo ' ✔'
64
-
65
- echo -n ' *** uBlock0.safariextension: Generating Info.plist...'
66
- python tools/make-safari-meta.py " $DES " /
67
- echo ' ✔'
68
-
69
- # https://github.com/el1t/uBlock-Safari/issues/15
70
- echo -n ' *** uBlock0.safariextension: Correcting ctrl to ⌘ in messages...'
71
- for filename in " $DES " /_locales/* .json; do
72
- sed -i ' ' ' s/Ctrl/⌘/g' " $filename "
73
- done
79
+ rm -f " $DES " /js/client-injected.js
74
80
echo ' ✔'
75
81
82
+ # Prepare extension for release
76
83
if [ " $1 " = all ]; then
77
84
if [ ! -f dist/certs/key.pem ] || [ ! -f dist/certs/SafariDeveloper.cer ]; then
78
85
echo ' *** uBlock0.safariextension: Cannot sign extension; missing credentials'
0 commit comments