dot

packages and services management
Log | Files | Refs | README

commit 9a7302b886aee1079b37e0ae95947cd4b5613a09
parent 1824e1b78585213ce817169a9165e81dd7cb18c7
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sun, 18 Feb 2018 21:27:20 +0100

found a way to avoid replicating code over and again

Diffstat:
Dbin/log | 5-----
Mrun/ii | 14++++++++++----
Drun/irc.cyberia.is | 15---------------
Drun/irc.freenode.net | 15---------------
Drun/irc.oftc.net | 15---------------
Drun/unix.chat | 15---------------
6 files changed, 10 insertions(+), 69 deletions(-)

diff --git a/bin/log b/bin/log @@ -1,5 +0,0 @@ -#!/bin/sh - -[ "$#" -ge 1 ] || exec ls -R "$HOME/var/log/$1" - -exec less "$HOME/var/log/$1" diff --git a/run/ii b/run/ii @@ -1,16 +1,22 @@ #!/bin/sh -e +# Connect to an irc server through ii. If there is a socket in /tmp with the +# same name as the host, assume it is an openssl s_client inetd proxy and use +# the ii -u option to connect through it, otherwise use the port argument. + host="${1:?host required}" port="${2:-6667}" +[ -S "/tmp/$host" ] && p="u" port="/tmp/$host" || p="p" + mkdir -p "$HOME/var/irc/$host" "$HOME/var/log/ii" pgrep -f "ii -s $host" || exec ii \ -s "$host" \ - -i "$HOME/var/irc" \ - -p "$port" \ - -n "$NICKii" \ + -i "$HOME/var/irc" \ + -$p "$port" \ + -n "$NICK" \ -k "PASS" \ -f "$NAME" \ 1>> "$HOME/var/irc/$host/log" \ - 2>> "$HOME/var/log/ii/$host" & + 2>> "$HOME/var/log/ii/$host" & diff --git a/run/irc.cyberia.is b/run/irc.cyberia.is @@ -1,15 +0,0 @@ -#!/bin/sh -e - -host='irc.cyberia.is' - -mkdir -p "$HOME/var/irc/$host" "$HOME/var/log/ii" - -pgrep -f "ii -s $host" || exec ii \ - -s "$host" \ - -i "$HOME/var/irc" \ - -u "/tmp/$host" \ - -n "$NICKii" \ - -k "PASS" \ - -f "$NAME" \ - 1>> "$HOME/var/irc/$host/log" \ - 2>> "$HOME/var/log/ii/$host" & diff --git a/run/irc.freenode.net b/run/irc.freenode.net @@ -1,15 +0,0 @@ -#!/bin/sh -e - -host='irc.freenode.net' - -mkdir -p "$HOME/var/irc/$host" "$HOME/var/log/ii" - -pgrep -f "ii -s $host" || exec ii \ - -s "$host" \ - -i "$HOME/var/irc" \ - -u "/tmp/$host" \ - -n "$NICKii" \ - -k "PASS" \ - -f "$NAME" \ - 1>> "$HOME/var/irc/$host/log" \ - 2>> "$HOME/var/log/ii/$host" & diff --git a/run/irc.oftc.net b/run/irc.oftc.net @@ -1,15 +0,0 @@ -#!/bin/sh -e - -host='irc.oftc.net' - -mkdir -p "$HOME/var/irc/$host" "$HOME/var/log/ii" - -pgrep -f "ii -s $host" || exec ii \ - -s "$host" \ - -i "$HOME/var/irc" \ - -u "/tmp/$host" \ - -n "$NICKii" \ - -k "PASS" \ - -f "$NAME" \ - 1>> "$HOME/var/irc/$host/log" \ - 2>> "$HOME/var/log/ii/$host" & diff --git a/run/unix.chat b/run/unix.chat @@ -1,15 +0,0 @@ -#!/bin/sh -e - -host='unix.chat' - -mkdir -p "$HOME/var/irc/$host" "$HOME/var/log/ii" - -pgrep -f "ii -s $host" || exec ii \ - -s "$host" \ - -i "$HOME/var/irc" \ - -u "/tmp/$host" \ - -n "$NICKii" \ - -k "PASS" \ - -f "$NAME" \ - 1>> "$HOME/var/irc/$host/log" \ - 2>> "$HOME/var/log/ii/$host" &