ソースを参照

rpm build files

Tobias Begalke 7 年 前
コミット
b7e3dc1959
4 ファイル変更147 行追加0 行削除
  1. 1 0
      .gitignore
  2. 50 0
      build-rpm.sh
  3. 8 0
      defaults/munchclient
  4. 88 0
      init.d/munchclient

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
 /munchclient
 /*.csv
 /m
+*.rpm

+ 50 - 0
build-rpm.sh

@@ -0,0 +1,50 @@
+#!/bin/bash
+
+DESTDIR=./dist
+VERSION=`git describe --tag | sed 's/^v//'`
+ITERATION=1
+BINARY=munchclient
+DEFAULTS_FILE="$BINARY"
+SERVICE_FILE="$BINARY.service"
+PKG_TYPE=rpm
+DESCR="ScraperWall traffic collector"
+RPM_DIR=/opt/rpm.scraperwall.com/centos6
+
+
+rm -rf $DESTDIR
+install -v -d $DESTDIR/{usr/bin,etc/init.d,etc/default}
+make
+
+install -v -m 755 $BINARY $DESTDIR/usr/bin/
+install -v -m 644 defaults/$DEFAULTS_FILE $DESTDIR/etc/default/
+#install -v -m 755 init.d/$BINARY $DESTDIR/etc/init.d/
+
+#install -m 644 $SERVICE_FILE $DESTDIR/etc/systemd/system/
+#install -m 644 $MAXMIND_CITY_DB $DESTDIR/usr/share/munch/
+#install -m 644 $MAXMIND_ASN_DB $DESTDIR/usr/share/munch/
+
+
+fpm -s dir -t $PKG_TYPE -C $DESTDIR --name $BINARY \
+  --version $VERSION \
+  --iteration $ITERATION \
+  --description "$DESCR" \
+  --config-files etc/default/$BINARY \
+  --rpm-init init.d/$BINARY \
+	--rpm-sign
+  # --deb-systemd $SERVICE_FILE \
+
+ok=$?
+
+rm -rf $DESTDIR
+
+exit
+
+rpm_file="munch-$VERSION-$ITERATION.x86_64.rpm"
+if [ $ok -eq 0 -a -f "$rpm_file" ]; then
+	rm -f "$RPM_DIR/munch-*.rpm"
+  cp "$rpm_file" "$RPM_DIR"
+
+	(cd "$RPM_DIR" && \
+   createrepo -v . && \
+   rsync -av --progress --delete . fender.spyz.org:/srv/http-vhosts/rpm.scraperwall.com/)
+fi

+ 8 - 0
defaults/munchclient

@@ -0,0 +1,8 @@
+FILTER="tcp port 80 and host 10.1.1.1"
+INTERFACE="eth0"
+LIVE=yes
+NATS_QUEUE=requests
+NATS_URL=nats://127.0.0.1:4222
+PROMISCUOUS=false
+USE_X_FORWARDED=true
+

+ 88 - 0
init.d/munchclient

@@ -0,0 +1,88 @@
+#!/bin/bash
+#
+# munchclient                     Startup script for munchclient
+#
+# chkconfig: 2345 12 88
+# description: Munchclient collects HTTP requests and sends them to the ScraperWall queue
+### BEGIN INIT INFO
+# Provides: $syslog
+# Required-Start: $local_fs $network
+# Required-Stop: $local_fs $network
+# Default-Start:  2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: ScraperWall HTTP request collector
+# Description: Munchclient is the ScraperWall HTTP-request collector
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+
+RETVAL=0
+PIDFILE=/var/run/munchclient.pid
+
+prog=munchclient
+exec=/usr/bin/munchclient
+lockfile=/var/lock/subsys/$prog
+
+# Source config
+if [ -f /etc/sysconfig/$prog ] ; then
+    . /etc/sysconfig/$prog
+fi
+
+start() {
+	[ -x $exec ] || exit 5
+
+	umask 077
+
+        echo -n $"Starting ScraperWall request collector: "
+        daemon --pidfile="$PIDFILE" $exec -i "$PIDFILE" $SYSLOGD_OPTIONS
+        RETVAL=$?
+        echo
+        [ $RETVAL -eq 0 ] && touch $lockfile
+        return $RETVAL
+}
+stop() {
+        echo -n $"Shutting down ScraperWall request collector: "
+        killproc -p "$PIDFILE" $exec
+        RETVAL=$?
+        echo
+        [ $RETVAL -eq 0 ] && rm -f $lockfile
+        return $RETVAL
+}
+rhstatus() {
+        status -p "$PIDFILE" -l $prog $exec
+}
+restart() {
+        stop
+        start
+}
+
+case "$1" in
+  start)
+        start
+        ;;
+  stop)
+        stop
+        ;;
+  restart)
+        restart
+        ;;
+  reload)
+        exit 3
+        ;;
+  force-reload)
+        restart
+        ;;
+  status)
+        rhstatus
+        ;;
+  condrestart|try-restart)
+        rhstatus >/dev/null 2>&1 || exit 0
+        restart
+        ;;
+  *)
+        echo $"Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status}"
+        exit 3
+esac
+
+exit $?