diff options
author | makefu <github@syntax-fehler.de> | 2015-08-28 23:39:37 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2015-08-28 23:39:37 +0200 |
commit | 7eba4293714b9dce86c07ccf2fdaddaa11a4c3c7 (patch) | |
tree | 28fdc7158cd28e4b25cf5674ab54da8da8b69c1e /commands | |
parent | 15026716ab3057998cf2f487742c2dd8e185335c (diff) |
Reaktor: add nix support, packaging
Diffstat (limited to 'commands')
-rwxr-xr-x | commands/badcommand | 1 | ||||
-rwxr-xr-x | commands/caps | 13 | ||||
-rwxr-xr-x | commands/hello | 2 | ||||
-rwxr-xr-x | commands/identify | 22 | ||||
-rwxr-xr-x | commands/licht_resolver | 37 | ||||
-rwxr-xr-x | commands/nag | 68 | ||||
-rwxr-xr-x | commands/reload | 2 | ||||
-rwxr-xr-x | commands/respond | 2 | ||||
-rwxr-xr-x | commands/rev | 2 | ||||
l--------- | commands/revip | 1 | ||||
-rwxr-xr-x | commands/say | 2 | ||||
l--------- | commands/subdomains | 1 | ||||
-rwxr-xr-x | commands/taken | 28 | ||||
-rwxr-xr-x | commands/tell-on_join | 19 | ||||
-rwxr-xr-x | commands/tell-on_privmsg | 17 | ||||
-rwxr-xr-x | commands/uptime | 8 | ||||
l--------- | commands/visit-page | 1 | ||||
-rwxr-xr-x | commands/whatweb | 17 | ||||
-rwxr-xr-x | commands/whois | 4 |
19 files changed, 0 insertions, 247 deletions
diff --git a/commands/badcommand b/commands/badcommand deleted file mode 100755 index c59b4d1..0000000 --- a/commands/badcommand +++ /dev/null @@ -1 +0,0 @@ -#? //retard diff --git a/commands/caps b/commands/caps deleted file mode 100755 index ac8cc66..0000000 --- a/commands/caps +++ /dev/null @@ -1,13 +0,0 @@ -#! /usr/bin/env python3 -import imp -import os - -def load_config(filename): - dirname = os.path.dirname(filename) - modname, ext = os.path.splitext(os.path.basename(filename)) - file, pathname, description = imp.find_module(modname, [ dirname ]) - return imp.load_module(modname, file, pathname, description) - -config = load_config(os.environ['config_filename']) -print('Private: '+' '.join(filter(None,[ x.get('capname',None) for x in config.commands]))) -print('Public: '+' '.join(filter(None,[ x.get('capname',None) for x in config.public_commands]))) diff --git a/commands/hello b/commands/hello deleted file mode 100755 index 05ed79b..0000000 --- a/commands/hello +++ /dev/null @@ -1,2 +0,0 @@ -#! /bin/sh -echo "Hello${*+, $*}!" diff --git a/commands/identify b/commands/identify deleted file mode 100755 index c2fb2c5..0000000 --- a/commands/identify +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python -import imp -import os,sys - -def load_config(filename): - dirname = os.path.dirname(filename) - modname, ext = os.path.splitext(os.path.basename(filename)) - file, pathname, description = imp.find_module(modname, [ dirname ]) - return imp.load_module(modname, file, pathname, description) - -config = load_config(os.environ['config_filename']) - -with open(config.admin_file) as f: - for line in f: - nick,secret = line.split() - if sys.argv[1] == secret: - print("identified you as %s!"%nick) - with open(config.auth_file,'a+') as g: - g.write(os.environ['_prefix'] +"\n") - sys.exit(0) - -print("unable to identify you, sorry") diff --git a/commands/licht_resolver b/commands/licht_resolver deleted file mode 100755 index 5bdb651..0000000 --- a/commands/licht_resolver +++ /dev/null @@ -1,37 +0,0 @@ -#! /usr/bin/python -# -*- coding: utf-8 -*- - -map = { - 'shackspace': { - 'device': { - 0: 'Licht0, Zickenzone; Fenster', - 1: 'Licht1, Sofaecke; Fenster', - 2: 'Licht2, Zickenzone; Ghetto', - 3: 'Licht3, Sofaecke; Ghetto', - 4: 'Licht4, Richtung Getränkelager', - 5: 'Licht5, Porschekonsole', - 6: 'Licht6, Tomatenecke', - 7: 'Licht7, Ghetto', - 10: 'Hauptschalter' - }, - 'state': { - 0: 'aus', - 1: 'an', - 2: 'aus in T-10s' - }, - '->': 'ist' - } -} - -from struct import unpack -import json -from os import environ as env - -location = "shackspace" - -map = map[location] -print (env["payload"]+"") -did, sid= unpack('BB', json.loads(env['payload'])) -device,state = map['device'][did], map['state'][sid] -arrow = map['->'] -print ' '.join([device, arrow, state]) diff --git a/commands/nag b/commands/nag deleted file mode 100755 index f214139..0000000 --- a/commands/nag +++ /dev/null @@ -1,68 +0,0 @@ -#! /bin/sh -set -euf -if test -e nag.hosts.ls; then - echo "nag seems to run already... if not, then delete $workdir/nag.*, please" - exit 23 -fi - -trap 'rm -f nag.hosts.ls nag.services.ls nag.patch' EXIT INT QUIT - - -# usage: git_pull_output_filter REPO_NAME -git_pull_output_filter() { - sed -n 's/^ [0-9]\+ file change/'"$1"': &/p' -} - - -if ! test -d nag.hosts; then - git clone "$hosts_repo" nag.hosts -else - (cd nag.hosts && git pull) | git_pull_output_filter hosts -fi - -if ! test -d nag.services; then - git clone "$services_repo" nag.services -else - (cd nag.services && git pull) | git_pull_output_filter services -fi - - -(cd nag.hosts && ls | sort) > nag.hosts.ls -(cd nag.services && ls | sort) > nag.services.ls - -diff -u nag.hosts.ls nag.services.ls > nag.patch || : - -missing_services=$(sed -n '1d;2d;s/^-\(.*\)/\1/p' nag.patch | tr '\n' ' ') -obsolete_services=$(sed -n '1d;2d;s/^+\(.*\)/\1/p' nag.patch | tr '\n' ' ') - -if test "${inspect_services-false}" = true; then - missing_owners=$(set +f; cd nag.services && grep '^owner:$' * | cut -d: -f1) - missing_mailtos=$(set +f; cd nag.services && grep '^mailto:$' * | cut -d: -f1) -fi - -nag_missing_services='missing services' -nag_obsolete_services='obsolete services' -nag_missing_owners='services with missing owner entry' -nag_missing_mailtos='services with missing mailto entry' - -# -# output -# -did_nag=false -for i in \ - missing_services \ - obsolete_services \ - missing_owners \ - missing_mailtos -do - eval "offenders=\${$i-}; nag_msg=\$nag_$i" - if test -n "$offenders"; then - echo $nag_msg: $offenders - did_nag=true - fi -done - -# if asked directly, answer if there is nothing to nag about -if test $did_nag = false -a -n "${_from:-}";then - echo "nothing to nag about" -fi diff --git a/commands/reload b/commands/reload deleted file mode 100755 index bfa1f04..0000000 --- a/commands/reload +++ /dev/null @@ -1,2 +0,0 @@ -#! /bin/sh -exec pkill -U reaktor diff --git a/commands/respond b/commands/respond deleted file mode 100755 index e23dc3e..0000000 --- a/commands/respond +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -printf '%s\n' "${_from}: $*" diff --git a/commands/rev b/commands/rev deleted file mode 100755 index a8681ab..0000000 --- a/commands/rev +++ /dev/null @@ -1,2 +0,0 @@ -#! /bin/sh -git log -1 --format="%h by %an, %ar" diff --git a/commands/revip b/commands/revip deleted file mode 120000 index e2c3b7a..0000000 --- a/commands/revip +++ /dev/null @@ -1 +0,0 @@ -../repos/revip/revip
\ No newline at end of file diff --git a/commands/say b/commands/say deleted file mode 100755 index 8b83c05..0000000 --- a/commands/say +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -printf '%s\n' "$*" diff --git a/commands/subdomains b/commands/subdomains deleted file mode 120000 index 0489555..0000000 --- a/commands/subdomains +++ /dev/null @@ -1 +0,0 @@ -../repos/consolidate_dns/index
\ No newline at end of file diff --git a/commands/taken b/commands/taken deleted file mode 100755 index b8beba6..0000000 --- a/commands/taken +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -#!/bin/bash - -# domainavailable -# Fast, domain name checker to use from the shell -# Use globs for real fun: -# domainavailable blah{1..3}.{com,net,org,co.uk} -# Inspired by foca / giles: -# http://gilesbowkett.blogspot.com/2009/02/simple-bash-domain-availability.html - -for d in $@; -do -if host "$d" | grep "NXDOMAIN" >&/dev/null; then - w=$(whois "$d") - if ! test "$?" -eq 0 ;then - echo "$d - whois not available" - elif echo "$w" | grep -Ei "(No match|NOT FOUND|Status: free)" >&/dev/null; then - echo "$d available"; - elif echo "$w"| grep -Ei "(Status: invalid)" >&/dev/null ;then - echo "$d invalid" - else - echo "$d taken"; - fi -else - echo "$d taken"; -fi -done -exit 0 diff --git a/commands/tell-on_join b/commands/tell-on_join deleted file mode 100755 index 2dbff41..0000000 --- a/commands/tell-on_join +++ /dev/null @@ -1,19 +0,0 @@ -#! /bin/sh -set -euf - -# require flock from util-linux -if test "${FLOCK-}" != "$state_file"; then - exec env FLOCK="$state_file" flock "$state_file" "$0" "$@" -fi - -to="$_from" - -# print messages -sed -n '/^'"$to"' /{ - s/^\([^ ]\+\) \([^ ]\+\) <\([^>]\+\)> \(.*\)/\1: \4 2-- \2, \3/p -}' "$state_file" - -# delete messages -sed -i '/^'"$to"' /{ - d -}' "$state_file" diff --git a/commands/tell-on_privmsg b/commands/tell-on_privmsg deleted file mode 100755 index 5d0aff4..0000000 --- a/commands/tell-on_privmsg +++ /dev/null @@ -1,17 +0,0 @@ -#! /bin/sh -set -euf - -# require flock from util-linux -if test "${FLOCK-}" != "$state_file"; then - exec env FLOCK="$state_file" flock "$state_file" "$0" "$@" -fi - -from="$_prefix" -to="$1"; shift -msg="$*" -date=$(date) - -# TODO tell now, if already joined -printf '%s %s <%s> %s\n' "$to" "$from" "$date" "$msg" >> "$state_file" - -echo 'Consider it noted.' # that's what lambdabot says... diff --git a/commands/uptime b/commands/uptime deleted file mode 100755 index 7ff6416..0000000 --- a/commands/uptime +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/sh -# -# //Reactor/commands/uptime - IRC-optimized uptime output -# -uptime | sed ' - s/^\(.*\) up \(.*\) days\?, *\(.*\), *\(.*\) users\?, *load average: \(.*\)$/\1; \2d \3; \4u; \5/;t - s/^\(.*\) up *\(.*\), *\(.*\) users\?, *load average: \(.*\)$/\1; 0d \2; \3u; \4/;t -' diff --git a/commands/visit-page b/commands/visit-page deleted file mode 120000 index 8723336..0000000 --- a/commands/visit-page +++ /dev/null @@ -1 +0,0 @@ -../repos/view-website/runner.sh
\ No newline at end of file diff --git a/commands/whatweb b/commands/whatweb deleted file mode 100755 index 36711ef..0000000 --- a/commands/whatweb +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -#wrapper for WhatWeb -set -eu - -# whatweb is in path? -whatweb=whatweb -if ! type -p whatweb >/dev/null 2>&1 ;then - here=$(dirname `readlink -f $0`) - whatweb="$here/../repos/whatweb/whatweb" - if ! test -e "$whatweb" then - echo "!! cannot find usable whatweb installation in path or basedir ($whatweb)" - exit 1 - fi -fi - -[ -z "${1:-}" ] && echo "!! no host given" && exit 1 -exec $whatweb_bin --user-agent="Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0" -a 3 "$1" 2>&1 diff --git a/commands/whois b/commands/whois deleted file mode 100755 index b073389..0000000 --- a/commands/whois +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -(! type whois >/dev/null 2>/dev/null) && echo "whois does not exist" && exit 0 - -whois "${1?usage: $0 domain}" | sed -e '/^$/d' -e '/^%/d' -e '/^Nserver/d' -e 's/^\[.*/---/' -e '/^Changed/d' -e '/^Status/d' -e '/^Type/d' -e '/^PostalCode/d' -e '/^Phone/d' -e '/^Fax/d' -e '/Last update of WHOIS database/Q' -e '/ID:/d' |