Skip to content

Commit 3a6ee90

Browse files
committed
Added an installation script to grant certificates on the desktop
1 parent 958537f commit 3a6ee90

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

utils/certmanager.sh

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
cmd_exists (){
4+
type "$1" &> /dev/null;
5+
}
6+
7+
for sudo_cmd in "kdesu" "gksu" "pkexec"; do
8+
if cmd_exists $sudo_cmd ; then
9+
su_graph=$sudo_cmd
10+
echo $su_graph
11+
break
12+
fi
13+
done
14+
15+
cmd_exists () {
16+
type "$1" &> /dev/null;
17+
}
18+
19+
20+
export PATH=$PATH:/sbin/
21+
if cmd_exists update-ca-certificates; then
22+
ca_path=/usr/local/share/ca-certificates/
23+
ca_update_cmd=update-ca-certificates
24+
else
25+
if cmd_exists update-ca-trust; then
26+
ca_path=/usr/share/ca-certificates/trust-source/anchors/
27+
ca_update_cmd=update-ca-trust
28+
else
29+
$su_graph apt-get install ca-certificates
30+
ca_path=/usr/local/share/ca-certificates/
31+
ca_update_cmd=update-ca-certificates
32+
fi
33+
fi
34+
35+
$su_graph cp $1 $ca_path/createAgentLocal.crt
36+
$su_graph $ca_update_cmd
37+
#Alway run install, it does not hurt
38+
39+
if cmd_exists apt-get; then
40+
$su_graph apt-get install libnss3-tools
41+
certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n Arduino -i $1
42+
fi
43+
exit $?
44+

0 commit comments

Comments
 (0)