gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r15281 - in gauger: . bindings/c bindings/java bindings/jav


From: gnunet
Subject: [GNUnet-SVN] r15281 - in gauger: . bindings/c bindings/java bindings/java/org/gnunet/gauger bindings/python
Date: Tue, 24 May 2011 04:59:57 +0200

Author: bartpolot
Date: 2011-05-24 04:59:57 +0200 (Tue, 24 May 2011)
New Revision: 15281

Added:
   gauger/gauger
Removed:
   gauger/gauger-cli.py
Modified:
   gauger/bindings/c/gauger.h
   gauger/bindings/java/gauger.jar
   gauger/bindings/java/org/gnunet/gauger/Gauger.class
   gauger/bindings/java/org/gnunet/gauger/Gauger.java
   gauger/bindings/python/gauger.py
   gauger/install.sh
Log:
Improved installation procedure, chaged client name, updated bindings


Modified: gauger/bindings/c/gauger.h
===================================================================
--- gauger/bindings/c/gauger.h  2011-05-23 23:14:47 UTC (rev 15280)
+++ gauger/bindings/c/gauger.h  2011-05-24 02:59:57 UTC (rev 15281)
@@ -35,7 +35,7 @@
             __gauger_v[7] = "-c";\
             __gauger_v[8] = category;\
             __gauger_v[9] = (char *)NULL;\
-            execvp("gauger-cli.py",__gauger_v);\
+            execvp("gauger",__gauger_v);\
             perror("gauger");\
             _exit(1);\
         }else{\

Modified: gauger/bindings/java/gauger.jar
===================================================================
(Binary files differ)

Modified: gauger/bindings/java/org/gnunet/gauger/Gauger.class
===================================================================
(Binary files differ)

Modified: gauger/bindings/java/org/gnunet/gauger/Gauger.java
===================================================================
--- gauger/bindings/java/org/gnunet/gauger/Gauger.java  2011-05-23 23:14:47 UTC 
(rev 15280)
+++ gauger/bindings/java/org/gnunet/gauger/Gauger.java  2011-05-24 02:59:57 UTC 
(rev 15281)
@@ -45,7 +45,7 @@
         {
             String[] cmds = (revision == -1) ?
                 new String[] {
-                "gauger-cli.py",
+                "gauger",
                 "-d",
                 "" + value,
                 "-u",
@@ -56,7 +56,7 @@
                 name,
             } :
             new String[] {
-                "gauger-cli.py",
+                "gauger",
                 "-d",
                 "" + value,
                 "-u",

Modified: gauger/bindings/python/gauger.py
===================================================================
--- gauger/bindings/python/gauger.py    2011-05-23 23:14:47 UTC (rev 15280)
+++ gauger/bindings/python/gauger.py    2011-05-24 02:59:57 UTC (rev 15281)
@@ -27,7 +27,7 @@
 GAUGER main function: try to execute the gauger client and log data to remote 
server
 """
 def GAUGER(category, counter, value, unit):
-    os.system("gauger-cli.py -c %s -n %s -d %s -u %s > /dev/null" % (category, 
counter, value, unit))
+    os.system("gauger -c %s -n %s -d %s -u %s > /dev/null" % (category, 
counter, value, unit))
 
 def GAUGER(category, counter, value, unit, rev):
-    os.system("gauger-cli.py -c %s -n %s -d %s -u %s -i %s > /dev/null" % 
(category, counter, value, unit, rev))
\ No newline at end of file
+    os.system("gauger -c %s -n %s -d %s -u %s -i %s > /dev/null" % (category, 
counter, value, unit, rev))

Copied: gauger/gauger (from rev 15280, gauger/gauger-cli.py)
===================================================================
--- gauger/gauger                               (rev 0)
+++ gauger/gauger       2011-05-24 02:59:57 UTC (rev 15281)
@@ -0,0 +1,117 @@
+#!/usr/bin/env python
+"""gauger-cli.py
+
+     This file is part of gauger.
+     Copyright 2011 Bartlomiej Polot
+
+     gauger is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published
+     by the Free Software Foundation; either version 2, or (at your
+     option) any later version.
+
+     gauger is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with gauger; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+
+Gauger client.
+
+"""
+import sys
+import os
+import subprocess
+import urllib
+
+if(sys.version_info[0] == 2 and sys.version_info[1] < 7):
+    import ap27 as arg_parser
+else:
+    import argparse as arg_parser
+
+def svnversion():
+    p = subprocess.Popen("svnversion", shell=True,
+      stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    (stdout, stderr) = p.communicate()
+    x = 1
+    while (stdout[0:x].isdigit()):
+      x += 1
+    if(x == 1):
+        return ""
+    return stdout[0:x-1]
+
+def process_arguments():
+    parser = arg_parser.ArgumentParser(description='Gauger client.')
+    parser.add_argument('-i', '--id',
+        help="identifier of the data, default: svn revision")
+    parser.add_argument('-n', '--name',
+        help="name of the counter")
+    parser.add_argument('-c', '--category',
+        help="category under which the counter will appear")
+    parser.add_argument('-d', '--data',
+        help="value of the data itself")
+    parser.add_argument('-u', '--unit',
+        help="unit in which the data is expressed")
+    parser.add_argument('-p', '--port', type=int,
+        help="port on which to connect")
+    parser.add_argument('--check', action='store_true',
+        help="check if gauger is correctly configured and exit")
+    args = parser.parse_args()
+    return args
+
+
+args = process_arguments()
+
+try:
+  configfile = open("gauger-cli.conf", "r")
+  remoteurl, username, password = configfile.readline().strip().split()
+except:
+  try:
+      homefilename = os.path.join(os.path.expanduser('~'), ".gauger-cli.conf")
+      configfile = open(homefilename, "r")
+      remoteurl, username, password = configfile.readline().strip().split()
+  except:
+    print >> sys.stderr, "please put 'remoteurl username password' in 
gauger-cli.conf"
+    exit(1)
+
+if(args.check):
+    exit(0)
+else:
+    if(not args.name or not args.data or not args.unit):
+        print >> sys.stderr, "NAME, DATA and UNIT are mandatory when sending 
data to server"
+        exit(1)
+
+if(args.id):
+    revision = args.id
+else:
+    revision = svnversion()
+
+if (not revision):
+  print >> sys.stderr, "please make sure to be in a svn respoitory and have 
svn installed"
+  print >> sys.stderr, "or specify an identifier at runtime with the --id 
option"
+  exit(1)
+
+if (int(revision) == 0):
+  print >> sys.stderr, "revision number cannot be 0, please try again with a 
valid number"
+  exit(1)
+
+if(args.unit):
+    args.name = args.name + "___" + args.unit
+
+if(args.category):
+    args.name = args.category + ":::" + args.name
+
+l1 = {'user': username, 'pass': password, 'revision': revision, 'name': 
args.name, 'value': args.data}
+try:
+   f = urllib.urlopen(remoteurl, urllib.urlencode(l1))
+except:
+  print >> sys.stderr, "Could not connect to", remoteurl
+  exit(1) 
+try:
+    print f.read()
+except:
+    print ""
+f.close()

Deleted: gauger/gauger-cli.py
===================================================================
--- gauger/gauger-cli.py        2011-05-23 23:14:47 UTC (rev 15280)
+++ gauger/gauger-cli.py        2011-05-24 02:59:57 UTC (rev 15281)
@@ -1,117 +0,0 @@
-#!/usr/bin/env python
-"""gauger-cli.py
-
-     This file is part of gauger.
-     Copyright 2011 Bartlomiej Polot
-
-     gauger is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
-     option) any later version.
-
-     gauger is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with gauger; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-
-Gauger client.
-
-"""
-import sys
-import os
-import subprocess
-import urllib
-
-if(sys.version_info[0] == 2 and sys.version_info[1] < 7):
-    import ap27 as arg_parser
-else:
-    import argparse as arg_parser
-
-def svnversion():
-    p = subprocess.Popen("svnversion", shell=True,
-      stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    (stdout, stderr) = p.communicate()
-    x = 1
-    while (stdout[0:x].isdigit()):
-      x += 1
-    if(x == 1):
-        return ""
-    return stdout[0:x-1]
-
-def process_arguments():
-    parser = arg_parser.ArgumentParser(description='Gauger client.')
-    parser.add_argument('-i', '--id',
-        help="identifier of the data, default: svn revision")
-    parser.add_argument('-n', '--name',
-        help="name of the counter")
-    parser.add_argument('-c', '--category',
-        help="category under which the counter will appear")
-    parser.add_argument('-d', '--data',
-        help="value of the data itself")
-    parser.add_argument('-u', '--unit',
-        help="unit in which the data is expressed")
-    parser.add_argument('-p', '--port', type=int,
-        help="port on which to connect")
-    parser.add_argument('--check', action='store_true',
-        help="check if gauger is correctly configured and exit")
-    args = parser.parse_args()
-    return args
-
-
-args = process_arguments()
-
-try:
-  configfile = open("gauger-cli.conf", "r")
-  remoteurl, username, password = configfile.readline().strip().split()
-except:
-  try:
-      homefilename = os.path.join(os.path.expanduser('~'), ".gauger-cli.conf")
-      configfile = open(homefilename, "r")
-      remoteurl, username, password = configfile.readline().strip().split()
-  except:
-    print >> sys.stderr, "please put 'remoteurl username password' in 
gauger-cli.conf"
-    exit(1)
-
-if(args.check):
-    exit(0)
-else:
-    if(not args.name or not args.data or not args.unit):
-        print >> sys.stderr, "NAME, DATA and UNIT are mandatory when sending 
data to server"
-        exit(1)
-
-if(args.id):
-    revision = args.id
-else:
-    revision = svnversion()
-
-if (not revision):
-  print >> sys.stderr, "please make sure to be in a svn respoitory and have 
svn installed"
-  print >> sys.stderr, "or specify an identifier at runtime with the --id 
option"
-  exit(1)
-
-if (int(revision) == 0):
-  print >> sys.stderr, "revision number cannot be 0, please try again with a 
valid number"
-  exit(1)
-
-if(args.unit):
-    args.name = args.name + "___" + args.unit
-
-if(args.category):
-    args.name = args.category + ":::" + args.name
-
-l1 = {'user': username, 'pass': password, 'revision': revision, 'name': 
args.name, 'value': args.data}
-try:
-   f = urllib.urlopen(remoteurl, urllib.urlencode(l1))
-except:
-  print >> sys.stderr, "Could not connect to", remoteurl
-  exit(1) 
-try:
-    print f.read()
-except:
-    print ""
-f.close()

Modified: gauger/install.sh
===================================================================
--- gauger/install.sh   2011-05-23 23:14:47 UTC (rev 15280)
+++ gauger/install.sh   2011-05-24 02:59:57 UTC (rev 15281)
@@ -1,10 +1,5 @@
 #!/bin/sh
 
-if [ "$(whoami)" != "root" ]; then
-    echo "Please consider running this script as root if you intend to install"
-    echo "gauger system-wide."
-fi
-
 echo $@ | grep "\-\-client" > /dev/null
 CLIENT=$?
 echo $@ | grep "\-\-server" > /dev/null
@@ -17,7 +12,14 @@
     exit 1
 fi
 
+if [ "$(whoami)" != "root" ]; then
+    echo "Please consider running this script as root if you intend to install"
+    echo "gauger system-wide."
+    echo ""
+    echo "WARNING: default paths probably will *NOT* work, please change them."
+fi
 
+
 if [ "$CLIENT" = "0" ]; then
 
 # ################ PYTHON ################ #
@@ -53,8 +55,8 @@
                 echo "and adapt scripts accordingly."
                 exit 1
             fi
-            sed -e "s/#!\/usr\/bin\/env python$/#!\/usr\/bin\/env python2/" 
gauger-cli.py > gauger-cli.tmp
-            mv gauger-cli.tmp gauger-cli.py
+            sed -e "s/#!\/usr\/bin\/env python$/#!\/usr\/bin\/env python2/" 
gauger > gauger.tmp
+            mv gauger.tmp gauger
             echo "Done!!"
             ;;
         *)
@@ -74,7 +76,7 @@
     if [ ! -d "$CLIENTPATH" ]; then
         mkdir -p "$CLIENTPATH"
     fi
-    cp "gauger-cli.py" "$CLIENTPATH"
+    cp "gauger" "$CLIENTPATH"
 
 fi # CLIENT PART
 
@@ -102,7 +104,7 @@
 
 # ################ PHP ################ #
 
-    V=$(php --version 2>&1 | head -n 1)
+    V=$(php --version 2>/dev/null | head -n 1)
     if [ "$?" != "0" ]; then
         echo "Please make sure PHP is installed."
         echo "Otherwise clients won't be able to visualize the data."
@@ -129,27 +131,54 @@
     if [ ! -d "$SERVERPATH" ]; then
         mkdir -p "$SERVERPATH"
     fi
-    echo "Please input route where to write the apache VirtualHost file"
-    echo "  default [/etc/apache2/sites-enabled/]"
+
+    echo "Please input route where store the gauger configuration files"
+    echo "  default [/etc/gauger]"
     read CONFIGPATH
     if [ "$CONFIGPATH" = "" ]; then
-        CONFIGPATH="/etc/apache2/sites-enabled/"
+        CONFIGPATH="/etc/gauger"
     fi
     if [ ! -d "$CONFIGPATH" ]; then
         mkdir -p "$CONFIGPATH"
     fi
+
+    echo "Please input route where to link the apache configuration file"
+    echo "  default [/etc/apache2/conf.d]"
+    read APACHEPATH
+    if [ "$APACHEPATH" = "" ]; then
+        APACHEPATH="/etc/apache2/conf.d"
+    fi
+    if [ ! -d "$APACHEPATH" ]; then
+        mkdir -p "$APACHEPATH"
+    fi
+
+    echo "Copying server files..."
     cp -r web/* "$SERVERPATH/"
     cp web/.htaccess "$SERVERPATH/"
-    cat > "$CONFIGPATH/gauger" <<EOF
-    <VirtualHost *:80>
-            Alias /gauger/ "$SERVERPATH/"
-            <Directory "$SERVERPATH/">
-                    Order allow,deny
-                    Allow from all
-                    AllowOverride Limit FileInfo
-            </Directory>
-    </VirtualHost>
+
+    echo "Creating configuration files..."
+    cat > "$CONFIGPATH/apache.conf" <<EOF
+Alias /gauger/ "$SERVERPATH/"
+<Directory "$SERVERPATH/">
+    Order allow,deny
+    Allow from all
+    AllowOverride Limit FileInfo
+</Directory>
 EOF
+    cat > "$CONFIGPATH/gauger.conf" <<EOF
+[dir]
+/var/lib/gauger
 
+[hosts]
+#user,password=hostname
+EOF
+    ln -s "$CONFIGPATH/apache.conf" "$APACHEPATH/gauger"
+    cp "$CONFIGPATH/gauger.conf" "$SERVERPATH/"
 
+    echo "Restarting Apache..."
+    apachectl -k graceful
+
+    echo "Please edit $SERVERPATH/gauger.conf to set your data directory"
+    echo "of choice and add usernames and passwords for gauger users."
+
 fi #Server part




reply via email to

[Prev in Thread] Current Thread [Next in Thread]