-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_mailvelope_gpgmejson.sh
executable file
·135 lines (127 loc) · 6.16 KB
/
install_mailvelope_gpgmejson.sh
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
130
131
132
133
134
135
#!/usr/bin/env bash
printf " Based on: ${CYAN} https://github.com/mailvelope/mailvelope/wiki/Creating-the-app-manifest-file-on-macOS-and-Linux
"
# TODO : FIX FOR CHROMIUM BASED BROWSERS
# https://github.com/mailvelope/mailvelope/wiki/Creating-the-app-manifest-file-on-macOS-and-Linux
# No idea what im doing wrong?
if ! test -f checks/check_system.sh; then
eval "$(curl -fsSL https://raw.githubusercontent.com/excited-bore/dotfiles/main/checks/check_system.sh)"
else
. ./checks/check_system.sh
fi
if ! test -f aliases/.bash_aliases.d/00-rlwrap_scripts.sh; then
eval "$(curl -fsSL https://raw.githubusercontent.com/excited-bore/dotfiles/main/aliases/.bash_aliases.d/00-rlwrap_scripts.sh)"
else
. ./aliases/.bash_aliases.d/00-rlwrap_scripts.sh
fi
if ! type gpgme-json &> /dev/null; then
echo "Install gpgme-json first"
return 1
fi
gpgme_json="$(whereis gpgme-json | awk '{print $2;}')"
if test $machine == 'Mac'; then
if test -d ~/Library/Application Support/Google/Chrome && ! test -f ~/Library/Application Support/Google/Chrome/NativeMessagingHosts/gpgmejson.json; then
reade -Q "BLUE" -i "y" -p "Add gpgme-json for google chrome based browsers? "" ggl
if test $ggl == 'y'; then
file="{
\"name\": \"gpgmejson\",
\"description\": \"JavaScript binding for GnuPG\",
\"path\": \"$gpgme_json\",
\"type\": \"stdio\",
\"allowed_origins\": [\"chrome-extension://kajibbejlbohfaggdiogboambcijhkke/\"]
}"
mkdir -p ~/Library/Application Support/Google/Chrome/NativeMessagingHosts
echo $file > ~/Library/Application Support/Google/Chrome/NativeMessagingHosts/gpgmejson.json
fi
fi
if test -d ~/Library/Application Support/Microsoft Edge && ! test -f ~/Library/Application Support/Microsoft Edge/NativeMessagingHosts/gpgmejson.json; then
reade -Q "BLUE" -i "y" -p "Add gpgme-json for Edge? [Y/n]:" "n" edge
if test $edge == 'y'; then
file="{
\"name\": \"gpgmejson\",
\"description\": \"JavaScript binding for GnuPG\",
\"path\": \"$gpgme_json\",
\"type\": \"stdio\",
\"allowed_origins\": [\"chrome-extension://dgcbddhdhjppfdfjpciagmmibadmoapc/\"]
}"
mkdir -p ~/Library/Application Support/Microsoft Edge/NativeMessagingHosts
echo $file > ~/Library/Application Support/Microsoft Edge/NativeMessagingHosts/gpgmejson.json
fi
fi
if test -d ~/Library/Application Support/Mozilla && ! test -f ~/Library/Application Support/Mozilla/NativeMessagingHosts/NativeMessagingHosts/gpgmejson.json; then
reade -Q "BLUE" -i "y" -p "Add gpgme-json for firefox? "" mozilla
if test $mozilla == 'y'; then
file="{
\"name\": \"gpgmejson\",
\"description\": \"JavaScript binding for GnuPG\",
\"path\": \"$gpgme_json\",
\"type\": \"stdio\",
\"allowed_extensions\": [\"jid1-AQqSMBYb0a8ADg@jetpack\"]
}"
mkdir -p ~/Library/Application Support/Mozilla/NativeMessagingHosts
echo $file > ~/Library/Application Support/Mozilla/NativeMessagingHosts/gpgmejson.json
fi
fi
elif test $machine == 'Linux'; then
if test -d ~/.config/google-chrome/ && ! test -f ~/.config/google-chrome/NativeMessagingHosts/gpgmejson.json; then
reade -Q "BLUE" -i "y" -p "Add gpgme-json for google chrome based browsers? "" ggl
if test $ggl == 'y'; then
file="{
\"name\": \"gpgmejson\",
\"description\": \"JavaScript binding for GnuPG\",
\"path\": \"$gpgme_json\",
\"type\": \"stdio\",
\"allowed_origins\": [\"chrome-extension://kajibbejlbohfaggdiogboambcijhkke/\"]
}"
mkdir -p ~/.config/google-chrome/NativeMessagingHosts
echo $file > ~/.config/google-chrome/NativeMessagingHosts/gpgmejson.json
fi
fi
if test -d ~/.config/BraveSoftware/Brave-Browser/ && ! test -f ~/.config/BraveSoftware/Brave-Browser/NativeMessagingHosts/gpgmejson.json; then
reade -Q "BLUE" -i "y" -p "Add gpgme-json for brave browser? "" brave
if test $brave == 'y'; then
file="{
\"name\": \"gpgmejson\",
\"description\": \"JavaScript binding for GnuPG\",
\"path\": \"$gpgme_json\",
\"type\": \"stdio\",
\"allowed_origins\": [\"chrome-extension://kajibbejlbohfaggdiogboambcijhkke/\"]
}"
mkdir -p ~/.config/BraveSoftware/Brave-Browser/NativeMessagingHosts
echo $file > ~/.config/BraveSoftware/Brave-Browser/NativeMessagingHosts/gpgmejson.json
fi
fi
if test -d ~/.config/microsoft-edge/ && ! test -f ~/.config/microsoft-edge/NativeMessagingHosts/gpgmejson.json; then
reade -Q "BLUE" -i "y" -p "Add gpgme-json for Edge? "" edge
if test $edge == 'y'; then
file="{
\"name\": \"gpgmejson\",
\"description\": \"JavaScript binding for GnuPG\",
\"path\": \"$gpgme_json\",
\"type\": \"stdio\",
\"allowed_origins\": [\"chrome-extension://dgcbddhdhjppfdfjpciagmmibadmoapc/\"]
}"
mkdir -p ~/.config/microsoft-edge/NativeMessagingHosts
echo $file > ~/.config/microsoft-edge/NativeMessagingHosts/gpgmejson.json
fi
fi
if test -d ~/.mozilla/ && ! test -f ~/.mozilla/native-messaging-hosts/gpgmejson.json; then
reade -Q "BLUE" -i "y" -p "Add gpgme-json for firefox? "" mozilla
if test $mozilla == 'y'; then
file="{
\"name\": \"gpgmejson\",
\"description\": \"JavaScript binding for GnuPG\",
\"path\": \"$gpgme_json\",
\"type\": \"stdio\",
\"allowed_extensions\": [\"jid1-AQqSMBYb0a8ADg@jetpack\"]
}"
mkdir -p ~/.mozilla/native-messaging-hosts
echo $file > ~/.mozilla/native-messaging-hosts/gpgmejson.json
fi
fi
echo "${GREEN}Done!${normal} Don't forget to restart the ${CYAN}mailvelope${normal} extension if your browser is already running!"
else
echo "Sorry,$machine not supported"
return 1
fi
unset mozilla edge brave ggl