Adjust build system config and install files
authorNeutron Soutmun <neo.neutron@gmail.com>
Tue, 9 Jun 2009 03:07:55 +0000 (10:07 +0700)
committerNeutron Soutmun <neo.neutron@gmail.com>
Tue, 9 Jun 2009 03:07:55 +0000 (10:07 +0700)
  * Adjust build system config to install the files to appropriate paths.
  * The MAINTAINERCLEANFILES was added.
  * Now rahunas.db installed into the default directory /var/lib/rahunas.
  * RahuNAS daemon executable file (rahunasd) now installed into /usr/sbin.
  * Tool scripts now installed into the /usr/sbin and their names change to
    satisfy the debian policy.

15 files changed:
Makefile.am
configure.ac
data/Makefile.am
example/rahunas.init.in
lcfg/Makefile.am
src/Makefile.am
src/include/linux/netfilter_ipv4/Makefile.am [deleted file]
src/rh-task-bandwidth.c
src/rh-task-dbset.c
src/rh-task-iptables.c
tools/Makefile.am [new file with mode: 0644]
tools/rahunas-bandwidth.in [moved from tools/bandwidth.sh.in with 100% similarity]
tools/rahunas-firewall.in [moved from tools/firewall.sh.in with 100% similarity]
tools/rahunas-weblogin-config-update.in [moved from tools/weblogin-config-update.sh.in with 98% similarity]
xmlrpc/Makefile.am

index 03dcd72..8df37b5 100644 (file)
@@ -1,2 +1,2 @@
 EXTRA_DIST = weblogin
-SUBDIRS = xmlrpc lcfg src data
+SUBDIRS = xmlrpc lcfg src data tools example
index 3fc913f..903bb9a 100644 (file)
@@ -53,15 +53,16 @@ AC_TYPE_SIGNAL
 AC_FUNC_STRFTIME
 AC_CHECK_FUNCS([dup2])
 AC_CONFIG_FILES([
-       Makefile
-       xmlrpc/Makefile
+  Makefile
+  xmlrpc/Makefile
   lcfg/Makefile
-       src/Makefile
-       data/Makefile
-  src/include/linux/netfilter_ipv4/Makefile
-  tools/firewall.sh
-  tools/bandwidth.sh
-       tools/weblogin-config-update.sh
+  src/Makefile
+  data/Makefile
+  tools/Makefile
+  tools/rahunas-firewall
+  tools/rahunas-bandwidth
+  tools/rahunas-weblogin-config-update
+  example/Makefile
   example/rahunas.default
   example/rahunas.init
   example/rahunas.conf
index 2d4620f..ee07bb3 100644 (file)
@@ -1,5 +1,7 @@
 # Rahunas configuration and database file
-configdir = $(sysconfdir)/rahunas
-config_DATA = rahunas.db
+MAINTAINERCLEANFILES = Makefile.in
 
-EXTRA_DIST = $(config_DATA)
+databasedir = $(localstatedir)/lib/rahunas
+database_DATA = rahunas.db
+
+EXTRA_DIST = $(database_DATA)
index 02fd6ef..a688cca 100755 (executable)
@@ -16,10 +16,10 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin:@prefix@/sbin:@prefix@/bin
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 
-DAEMON=@bindir@/rahunasd
+DAEMON=@sbindir@/rahunasd
 INIT=@sysconfdir@/default/rahunas
-FIREWALL=@sysconfdir@/rahunas/firewall.sh
-WEBLOGIN_CONFIG=@sysconfdir@/rahunas/weblogin-config-update.sh
+FIREWALL=@sbindir@/rahunas-firewall
+WEBLOGIN_CONFIG=@sbindir@/rahunas-weblogin-config-update
 NAME=rahunasd
 DESC="Rahu Network Access Server"
 
index 5a7d706..dcad936 100644 (file)
@@ -1,3 +1,4 @@
-noinst_LIBRARIES = liblcfg.a
+MAINTAINERCLEANFILES = Makefile.in
 
+noinst_LIBRARIES = liblcfg.a
 liblcfg_a_SOURCES = lcfg_static.c lcfg_static.h 
index 5387f41..1dce159 100644 (file)
@@ -1,51 +1,59 @@
-SUBDIRS = include/linux/netfilter_ipv4
+MAINTAINERCLEANFILES = Makefile.in
 
-bin_PROGRAMS = rahunasd
+sbin_PROGRAMS = rahunasd
 
 IPSET_VERSION:=2.3.3
 
 AM_CFLAGS = \
-       $(LIBGNET_CFLAGS) \
-       $(LIBGDA_CFLAGS) \
-       -I$(top_builddir)/src/include/ \
-       -DRAHUNAS_VERSION=\"$(RAHUNAS_VERSION)\" \
-       -DPROGRAM=\"$(PROGRAM)\" \
-       -DIPSET_VERSION=\"$(IPSET_VERSION)\" \
-       -DRAHUNAS_CONF_DIR=\"$(sysconfdir)/rahunas/\" \
+  $(LIBGNET_CFLAGS) \
+  $(LIBGDA_CFLAGS) \
+  -I$(top_builddir)/src/include/ \
+  -DRAHUNAS_VERSION=\"$(RAHUNAS_VERSION)\" \
+  -DPROGRAM=\"$(PROGRAM)\" \
+  -DIPSET_VERSION=\"$(IPSET_VERSION)\" \
+  -DRAHUNAS_CONF_DIR=\"$(sysconfdir)/rahunas/\" \
+  -DRAHUNAS_DB_DIR=\"$(localstatedir)/lib/rahunas/\" \
   -DRAHUNAS_LOG_DIR=\"$(localstatedir)/log/rahunas/\" \
-  -DRAHUNAS_RUN_DIR=\"$(localstatedir)/run/\"
+  -DRAHUNAS_RUN_DIR=\"$(localstatedir)/run/\" \
+  -DRAHUNAS_FIREWALL_WRAPPER=\"$(sbindir)/rahunas-firewall\" \
+  -DRAHUNAS_BANDWIDTH_WRAPPER=\"$(sbindir)/rahunas-bandwidth\"
 
 rahunasd_SOURCES = \
-       rahunasd.c \
-       rahunasd.h \
-       rh-server.c \
-       rh-server.h \
-       rh-xmlrpc-server.c \
-       rh-xmlrpc-server.h \
-       rh-xmlrpc-cmd.c \
-       rh-xmlrpc-cmd.h \
+  rahunasd.c \
+  rahunasd.h \
+  rh-server.c \
+  rh-server.h \
+  rh-xmlrpc-server.c \
+  rh-xmlrpc-server.h \
+  rh-xmlrpc-cmd.c \
+  rh-xmlrpc-cmd.h \
   rh-ipset.c \
-       rh-ipset.h \
-       rh-utils.c \
-       rh-utils.h \
-       rh-task.c \
-       rh-task.h \
-       rh-task-iptables.c \
-       rh-task-iptables.h \
-       rh-task-memset.c \
-       rh-task-memset.h \
-       rh-task-ipset.c \
-       rh-task-ipset.h \
-       rh-task-dbset.c \
-       rh-task-dbset.h \
+  rh-ipset.h \
+  rh-utils.c \
+  rh-utils.h \
+  rh-task.c \
+  rh-task.h \
+  rh-task-iptables.c \
+  rh-task-iptables.h \
+  rh-task-memset.c \
+  rh-task-memset.h \
+  rh-task-ipset.c \
+  rh-task-ipset.h \
+  rh-task-dbset.c \
+  rh-task-dbset.h \
   rh-task-bandwidth.c \
   rh-task-bandwidth.h \
   rh-radius.h \
   rh-config.c \
-       rh-config.h
+  rh-config.h
 
 rahunasd_LDADD =  \
-       $(top_builddir)/xmlrpc/libgnetxmlrpc.a \
+  $(top_builddir)/xmlrpc/libgnetxmlrpc.a \
   $(top_builddir)/lcfg/liblcfg.a \
-       $(LIBGNET_LIBS) \
-       $(LIBGDA_LIBS)
+  $(LIBGNET_LIBS) \
+  $(LIBGDA_LIBS)
+
+noinst_HEADERS = \
+  include/linux/netfilter_ipv4/ip_set.h \
+  include/linux/netfilter_ipv4/ip_set_rahunas.h
+
diff --git a/src/include/linux/netfilter_ipv4/Makefile.am b/src/include/linux/netfilter_ipv4/Makefile.am
deleted file mode 100644 (file)
index f743ac5..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-EXTRA_DIST= \
-       ip_set.h \
-       ip_set_rahunas.h
index 5bc19e7..2e3921c 100644 (file)
@@ -18,8 +18,6 @@
 #include "rh-task-memset.h"
 #include "rh-utils.h"
 
-#define BANDWIDTH_WRAPPER "/etc/rahunas/bandwidth.sh"
-
 static unsigned short slot_flags[MAX_SLOT_PAGE] = {1};
 static unsigned short slot_count = 0;
 
@@ -92,7 +90,7 @@ int bandwidth_exec(struct vserver *vs, char *const args[])
 
   if (pid == 0) {
     // Child
-    execv(BANDWIDTH_WRAPPER, args);
+    execv(RAHUNAS_BANDWIDTH_WRAPPER, args);
   } else if (pid < 0) {
     // Fork error
     logmsg(RH_LOG_ERROR, "Error: vfork()"); 
@@ -141,7 +139,7 @@ int bandwidth_start(struct vserver *vs)
 
   DP("Bandwidth: start");
 
-  args[0] = BANDWIDTH_WRAPPER;
+  args[0] = RAHUNAS_BANDWIDTH_WRAPPER;
   args[1] = "start";
   args[2] = iface->dev_internal;
   args[3] = iface->dev_ifb;
@@ -159,7 +157,7 @@ int bandwidth_stop(struct vserver *vs)
 
   DP("Bandwidth: stop");
 
-  args[0] = BANDWIDTH_WRAPPER;
+  args[0] = RAHUNAS_BANDWIDTH_WRAPPER;
   args[1] = "stop";
   args[2] = iface->dev_internal;
   args[3] = iface->dev_ifb;
@@ -177,7 +175,7 @@ int bandwidth_add(struct vserver *vs, struct bandwidth_req *bw_req)
   DP("Bandwidth: request %s %s %s %s", bw_req->slot_id, 
      bw_req->ip, bw_req->bandwidth_max_down, bw_req->bandwidth_max_up);
 
-  args[0] = BANDWIDTH_WRAPPER;
+  args[0] = RAHUNAS_BANDWIDTH_WRAPPER;
   args[1] = "add";
   args[2] = bw_req->slot_id;
   args[3] = bw_req->ip;
@@ -197,7 +195,7 @@ int bandwidth_del(struct vserver *vs, struct bandwidth_req *bw_req)
 
   DP("Bandwidth: request %s", bw_req->slot_id);
 
-  args[0] = BANDWIDTH_WRAPPER;
+  args[0] = RAHUNAS_BANDWIDTH_WRAPPER;
   args[1] = "del";
   args[2] = bw_req->slot_id;
   args[3] = iface->dev_internal;
index fc7f66f..c1e7ebf 100644 (file)
@@ -249,7 +249,7 @@ static int startservice ()
 {
   char ds_name[] = PROGRAM;
   char ds_provider[] = "SQLite";
-  char ds_cnc_string[] = "DB_DIR=" RAHUNAS_CONF_DIR ";DB_NAME=" DB_NAME; 
+  char ds_cnc_string[] = "DB_DIR=" RAHUNAS_DB_DIR ";DB_NAME=" DB_NAME; 
   char ds_desc[] = "RahuNAS DB Set";
 
   logmsg(RH_LOG_NORMAL, "Task DBSET start..");
index 26737c4..876bfd5 100644 (file)
@@ -16,8 +16,6 @@
 #include "rh-task.h"
 #include "rh-utils.h"
 
-#define IPTABLES_WRAPPER "/etc/rahunas/firewall.sh"
-
 int iptables_exec(struct vserver *vs, char *const args[])
 {
   pid_t ws;
@@ -77,7 +75,7 @@ int iptables_exec(struct vserver *vs, char *const args[])
 
   if (pid == 0) {
     // Child
-    execve(IPTABLES_WRAPPER, args, env);
+    execve(RAHUNAS_FIREWALL_WRAPPER, args, env);
   } else if (pid < 0) {
     // Fork error
     logmsg(RH_LOG_ERROR, "Error: vfork()"); 
@@ -112,7 +110,7 @@ int iptables_start(struct vserver *vs)
 
   DP("IPTables: start");
 
-  args[0] = IPTABLES_WRAPPER;
+  args[0] = RAHUNAS_FIREWALL_WRAPPER;
   args[1] = "start-config";
   args[2] = (char *) 0;
 
@@ -125,7 +123,7 @@ int iptables_stop(struct vserver *vs)
 
   DP("IPTables: stop");
 
-  args[0] = IPTABLES_WRAPPER;
+  args[0] = RAHUNAS_FIREWALL_WRAPPER;
   args[1] = "stop-config";
   args[2] = (char *) 0;
 
diff --git a/tools/Makefile.am b/tools/Makefile.am
new file mode 100644 (file)
index 0000000..c21387d
--- /dev/null
@@ -0,0 +1,6 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+dist_sbin_SCRIPTS = \
+       rahunas-firewall \
+       rahunas-bandwidth \
+       rahunas-weblogin-config-update
similarity index 98%
rename from tools/weblogin-config-update.sh.in
rename to tools/rahunas-weblogin-config-update.in
index 6f7054b..8a390e5 100644 (file)
@@ -22,7 +22,7 @@ get_config_value () {
 MAIN_CONF_DIR=`get_config_value main conf_dir $RAHUNAS_CONFIG`
 
 # DB
-RAHUNAS_DB=/etc/rahunas/rahunas.db
+RAHUNAS_DB=@localstatedir@/lib/rahunas/rahunas.db
 SQLITE3=/usr/bin/sqlite3
 
 generate_config() {
index 33b8089..3832476 100644 (file)
@@ -2,6 +2,8 @@
 
 @SET_MAKE@
 
+MAINTAINERCLEANFILES = Makefile.in
+
 noinst_LIBRARIES = libgnetxmlrpc.a
 
 noinst_PROGRAMS = \