Skip to content

Commit f4f1c0b

Browse files
mastrolinuxmatteosuppo
authored andcommitted
Check if the db already exists or create it.
1 parent 76a46e0 commit f4f1c0b

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

utils/certmanager.sh

+11-6
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ for sudo_cmd in "kdesu" "gksu" "pkexec"; do
1212
fi
1313
done
1414

15-
cmd_exists () {
16-
type "$1" &> /dev/null;
17-
}
18-
19-
2015
export PATH=$PATH:/sbin/
2116
if cmd_exists update-ca-certificates; then
2217
ca_path=/usr/local/share/ca-certificates/
@@ -37,8 +32,18 @@ $su_graph $ca_update_cmd
3732
#Alway run install, it does not hurt
3833

3934
if cmd_exists apt-get; then
35+
DBDIR="$HOME/.pki/nssdb"
4036
$su_graph apt-get install libnss3-tools
41-
certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n Arduino -i $1
37+
38+
# if the dir does not exists, created the cert db
39+
stat $DBDIR
40+
if [ "$?" -ne "0" ]; then
41+
mkdir -p $DBDIR
42+
certutil -d sql:$DBDIR -N
43+
fi
44+
45+
certutil -d sql:$DBDIR -A -t "C,," -n Arduino -i $1
4246
fi
4347
exit $?
4448

49+

0 commit comments

Comments
 (0)