summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure28
-rw-r--r--openwrt/rhctl/Makefile73
-rwxr-xr-xopenwrt/rhctl/files/rhctlsh6
-rw-r--r--openwrt/rhctl/files/switchctl.conf (renamed from switchctl.conf)0
-rwxr-xr-xopenwrt/rhctl/files/switchctl.init26
-rw-r--r--switchctl.c2
6 files changed, 106 insertions, 29 deletions
diff --git a/configure b/configure
index dca28c8..f4b30be 100755
--- a/configure
+++ b/configure
@@ -26,16 +26,9 @@ TARGET=`uname -s`
CFLAGS='-g -O2'
LDFLAGS='-g -Wall -O2'
-PREFIX='/usr/local'
-USERNAME='rhctl'
-USERHOME='/var/run/rhctl'
-
print_usage() {
echo "configure --help print this"
echo " --target=<TARGET> build target i.e. Linux (default: autodetect)"
- echo " --prefix=<PREFIX> the installation prefix (default: /usr/local)"
- echo " --username=<USERNAME> create this user when installing (default: rhctl)"
- echo " --userhome=<PATH> the home directory of the user to be created (default: /var/run/rhctl)"
}
for arg
@@ -44,15 +37,6 @@ do
--target=*)
TARGET=${arg#--target=}
;;
- --prefix=*)
- PREFIX=${arg#--prefix=}
- ;;
- --username=*)
- USERNAME=${arg#--username=}
- ;;
- --userhome=*)
- USERHOME=${arg#--userhome=}
- ;;
--help)
print_usage
exit 0
@@ -81,12 +65,6 @@ case $TARGET in
;;
esac
-if [ "x$PREFIX" = "x/usr" ]; then
- ETCDIR=/etc
-else
- ETCDIR=$PREFIX/etc
-fi
-
cat >> include.mk <<EOF
# this file was created automatically
# do not edit this file directly
@@ -96,12 +74,6 @@ TARGET := $TARGET
CC := gcc
CFLAGS := $CFLAGS
LDFLAGS := $LDFLAGS
-
-SBINDIR := $PREFIX/sbin
-MANDIR := $PREFIX/share/man
-ETCDIR := $ETCDIR
-USERNAME := $USERNAME
-USERHOME := $USERHOME
EOF
exit 0
diff --git a/openwrt/rhctl/Makefile b/openwrt/rhctl/Makefile
new file mode 100644
index 0000000..051a0ca
--- /dev/null
+++ b/openwrt/rhctl/Makefile
@@ -0,0 +1,73 @@
+#
+# Copyright (C) 2008 Christian Pointner,
+# <equinox@helsinki.at>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# This Makefile builds rhctl Package for OpenWRT
+#
+# $Id: $
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=rhctl
+PKG_VERSION:=0.1
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://localhost/
+PKG_MD5SUM:=72255c3437630155453616ba18d8fb25
+
+PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rhctl
+ SECTION:=utils
+ CATEGORY:=Utilities
+ TITLE:=radio helsinki control tools
+ URL:=http://www.helsinki.at
+ MAINTAINER:=Christian Pointner <equinox@helsinki.at>
+ DEPENDS:=+socat
+endef
+
+define Package/rhctl/conffiles
+/etc/rhctl/switchctl.conf
+endef
+
+define Package/rhctl/description
+rhctl is a collection of daemons and tools intended to control the
+ main audio switch of Radio Helsinki.
+endef
+
+define Build/Configure
+ (cd $(PKG_BUILD_DIR); \
+ touch include.mk; \
+ )
+endef
+
+define Build/Compile
+ rm -rf $(PKG_INSTALL_DIR)
+ mkdir -p $(PKG_INSTALL_DIR)
+
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ $(TARGET_CONFIGURE_OPTS) \
+ TARGET=Linux \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ LDFLAGS="$(TARGET_LDFLAGS) -ldl"
+ $(STRIP) $(PKG_BUILD_DIR)/switchctl
+endef
+
+define Package/rhctl/install
+ $(INSTALL_DIR) $(1)/etc/rhctl
+ $(INSTALL_DATA) ./files/switchctl.conf $(1)/etc/rhctl/
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/switchctl $(1)/usr/bin/
+ $(INSTALL_BIN) ./files/rhctlsh $(1)/usr/bin/
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/switchctl.init $(1)/etc/init.d/switchctl
+endef
+
+$(eval $(call BuildPackage,rhctl))
diff --git a/openwrt/rhctl/files/rhctlsh b/openwrt/rhctl/files/rhctlsh
new file mode 100755
index 0000000..47d5873
--- /dev/null
+++ b/openwrt/rhctl/files/rhctlsh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+RUN_D=/var/run/rhctl
+SOCK=$RUN_D/switchctl.sock
+
+/usr/bin/socat UNIX-CONNECT:$SOCK STDIO
diff --git a/switchctl.conf b/openwrt/rhctl/files/switchctl.conf
index 0364e0d..0364e0d 100644
--- a/switchctl.conf
+++ b/openwrt/rhctl/files/switchctl.conf
diff --git a/openwrt/rhctl/files/switchctl.init b/openwrt/rhctl/files/switchctl.init
new file mode 100755
index 0000000..c463f40
--- /dev/null
+++ b/openwrt/rhctl/files/switchctl.init
@@ -0,0 +1,26 @@
+#!/bin/sh /etc/rc.common
+START=50
+
+BIN=switchctl
+DAEMON=/usr/bin/$BIN
+DESC=$BIN
+RUN_D=/var/run/rhctl
+PIDFILE=$RUN_D/$BIN.pid
+
+start() {
+ echo -n "Starting $DESC:"
+ mkdir -p $RUN_D
+ $DAEMON --write-pid $PIDFILE
+ echo "."
+}
+
+stop() {
+ echo -n "Stopping $DESC:"
+ if [ -f $PIDFILE ]; then
+ kill `cat $PIDFILE` > /dev/null 2>&1
+ rm -f $PIDFILE > /dev/null 2>&1
+ else
+ echo -n "not running"
+ fi
+ echo "."
+}
diff --git a/switchctl.c b/switchctl.c
index a2d79b2..3a259fc 100644
--- a/switchctl.c
+++ b/switchctl.c
@@ -451,7 +451,7 @@ int main(int argc, char* argv[])
}
string_list_element_t* tmp = opt.log_targets_.first_;
if(!tmp) {
- log_add_target("syslog:3,rhctl,daemon");
+ log_add_target("syslog:3,switchctl,daemon");
}
else {
while(tmp) {