Skip to content

Added an installation script to grant certificates on the desktop #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions utils/certmanager.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

cmd_exists (){
type "$1" &> /dev/null;
}

for sudo_cmd in "kdesu" "gksu" "pkexec"; do
if cmd_exists $sudo_cmd ; then
su_graph=$sudo_cmd
echo $su_graph
break
fi
done

cmd_exists () {
type "$1" &> /dev/null;
}


export PATH=$PATH:/sbin/
if cmd_exists update-ca-certificates; then
ca_path=/usr/local/share/ca-certificates/
ca_update_cmd=update-ca-certificates
else
if cmd_exists update-ca-trust; then
ca_path=/usr/share/ca-certificates/trust-source/anchors/
ca_update_cmd=update-ca-trust
else
$su_graph apt-get install ca-certificates
ca_path=/usr/local/share/ca-certificates/
ca_update_cmd=update-ca-certificates
fi
fi

$su_graph cp $1 $ca_path/createAgentLocal.crt
$su_graph $ca_update_cmd
#Alway run install, it does not hurt

if cmd_exists apt-get; then
$su_graph apt-get install libnss3-tools
certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n Arduino -i $1
fi
exit $?