updated on Thu Jan 19 00:16:31 UTC 2012
[aur-mirror.git] / italc / italc.install
blob2f5c872abd37d56079f86dac1af3e3d77e837b3d
1 post_install() {
2         # first look for binary
3         IMCBIN="$(which imc 2> /dev/null)"
4         if [ -z "$IMCBIN" ] ; then
5                 echo "Error: no imc found in $PATH"
6                 exit 1
7         fi
9         # now search for keys, any other paths?
10         i=0;
11         for file in $( find /etc -regex '.*italc.*public/.*\|.*italc.*private/.*' ) ; do
12                 if [ ! -d "$file" ] ; then
13                 
14                         name_key[i]=$file ;
15                         i=$((i+1)); 
16                 fi
17         done
19         # check if any keys were not found, and create them
20         if [ -z "${name_key[0]}" ] ; then
21                 
22                 echo "No iTALC keys found, generating keys: $IMCBIN -role teacher -createkeypair"
23                 emsg="$( $IMCBIN -role teacher -createkeypair 2>&1 )"
24                 
25                 #check that createkeypair worked
26                 if [ "$?" -gt "0" ] ; then
27                         echo "Error generating keys: $emsg"
28                 else
29                         echo "iTALC keys generated successfully." &&
30                         #add group and change group assignment
31                         groupadd italc;
32                         chgrp -R italc /etc/italc/keys/private;
33                         #chmod  0750 /etc/italc/keys/private/teacher/key;
34                         chmod -R 640 /etc/italc/keys/private;
35                         chmod -R ug+X /etc/italc/keys/private;
36                 fi
37         # keys were found, show the installer and let them know default paths
38         else
39                 echo "iTALC keys found: ${name_key[@]}"
40                 echo -e "\nNOTE: Default iTALC key locations are: /etc/italc/keys/[public | private]/<role>/key "
41                 echo "If your keys are not in these directories, you should move,copy or link them."
42         fi
44         #postinstall instruction
45         echo "If you are installing on the master (aka teacher) computer, dont forget to add the user to the italc group."
47         # update of the icon cache
48         gtk-update-icon-cache /usr/share/icons/hicolor
51 post_update() {
52    /bin/true
55 post_remove() {
56   groupdel italc
57   if [ -d /etc/italc ]; then
58         rm -rf /etc/italc
59   fi