add nick name for cached records
[oweals/gnunet.git] / contrib / gnunet-gns-import.sh
1 #!/bin/sh
2 # This shell-script will import some GNS authorities into your GNS
3 # namestore.
4
5 LOCATION=$(which gnunet-config)
6 if [ -z $LOCATION ]
7 then
8         echo "GNUnet command line tools not found, check environmental variables PATH and GNUNET_PREFIX" 
9         exit 1
10 fi
11
12 gnunet-arm -I 1> /dev/null 2>/dev/null
13 if [ ! $? -eq 0 ]
14 then
15         echo "GNUnet is not running, please start GNUnet before running import" 
16         exit 1
17 fi
18
19 options=''
20
21 while getopts "c:" opt; do
22   case $opt in
23     c)
24       options+="-c $OPTARG"
25       ;;
26     \?)
27       echo "Invalid option: -$OPTARG" >&2
28       exit 1
29       ;;
30     :)
31       echo "Option -$OPTARG requires an argument." >&2
32       exit 1
33       ;;
34   esac
35 done
36
37 # By default, we create three GNS zones:
38 gnunet-identity -C master-zone $options
39 gnunet-identity -C short-zone $options
40 gnunet-identity -C private-zone $options
41
42 # Additionally, we create the FS SKS zone
43 gnunet-identity -C sks-zone $options
44
45 # Integrate those with the respective subsystems.
46 gnunet-identity -e short-zone -s gns-short $options
47 gnunet-identity -e master-zone -s gns-master $options
48 gnunet-identity -e master-zone -s gns-proxy $options
49 gnunet-identity -e private-zone -s gns-private $options
50 gnunet-identity -e sks-zone -s fs-sks $options
51
52 # Get the public keys as strings (so we can create PKEY records)
53 MASTER=`gnunet-identity -d $options | grep master-zone | awk '{print $3}'`
54 SHORT=`gnunet-identity -d $options | grep short-zone | awk '{print $3}'`
55 PRIVATE=`gnunet-identity -d $options | grep private-zone | awk '{print $3}'`
56
57 # Link short and private zones into master zone
58 gnunet-namestore -z master-zone -a -e never -n private -p -t PKEY -V $PRIVATE $options
59 gnunet-namestore -z master-zone -a -e never -n short -p -t PKEY -V $SHORT $options
60
61 # Link GNUnet's FCFS zone into master zone under label "pin"
62 gnunet-namestore -z master-zone -a -e never -n pin -p -t PKEY -V 72QC35CO20UJN1E91KPJFNT9TG4CLKAPB4VK9S3Q758S9MLBRKOG $options
63