commit a3c9477b68cb886bacde87f27de0cb57f8faf750 Spenser Truex <truex@equwal.com> 2025-08-30 17:59:21 -0400 Initial commit
README.md | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ irc-connect | 27 +++++++++++++++++ lchat-connect | 10 ++++++ services/lispirc | 33 ++++++++++++++++++++ 4 files changed, 162 insertions(+)
diff --git a/README.md b/README.md new file mode 100644 index 0000000..7b6dad4 --- /dev/null +++ b/README.md @@ -0,0 +1,92 @@ +# A suckless IRC package + +Get ii/lchat running on your machine. + +# INSTALL + +- Go install ii with the SSL patch added. This will run as a local server that makes files named in and out for lchat to +use. +- Go install lchat. It uses the suckless library grapheme that you will need to install and link up. +- Go to services and edit/install the file. You will need to register +with nickserv on liberachat. Install it on your machine. If you are +using a service that isn't in there, or you find it doesn't work, +please contribute. + +Copy irc-connect and lchat-connect to your path. Modify as needed. + +Make aliases for lchat-connect. +``` +# example +alias lispirc='/home/jose/src/sh/lchat-connect "$HOME/irc" "irc.libera.chat" "#lisp"' +``` + +# irc-connect +``` +#!/bin/sh + +TIMEOUT=10 +CHANNELSWAIT=1 + +# IRC client connector script +# Usage: irc-connect <server> <nick> <pass> <dir> [channel1] [channel2] ... + +SERVER="$1" +NICK="$2" +PASS="$3" +DIR="$4" +shift 4 + +ii -s "$SERVER" -n "$NICK" -i "$DIR" -e & +II_PID=$! +sleep "$TIMEOUT" +echo "IDENTIFY $NICK $PASS" >"$DIR"/"$SERVER"/nickerv/in + +# Join all provided channels +for channel in "$@"; do + echo "/j $channel" >"$DIR"/"$SERVER"/in + sleep "$CHANNELSWAIT" +done + +wait $II_PID +``` +# lchat-connect +``` + +#!/bin/sh + +# lchat connector script +# Usage: lchat-connect <dir> <server> <channel> + +DIR="$1" +SERVER="$2" +CHANNEL="$3" + +lchat -a "$DIR"/"$SERVER"/"$CHANNEL" +``` + +# openRC service for liberachat +``` +#!/sbin/openrc-run + +name="lispirc" +description="IRC client for #lisp on irc.libera.chat" + +command="/home/jose/src/sh/irc-connect" +command_args="(irc.libera.chat) <YOUR NICKSERV IDENT> <YOUR NICKSERV PASSWORD> <IRC FILES PATH> CHANNELS CHANNELS CHANNELS (eg. \#lisp)" +command_user="<USER>" +pidfile="/run/${RC_SVCNAME}.pid" +command_background="yes" + +depend() { + need net + after logger +} + +stop() { + local pid=$(cat "$pidfile") + ebegin "Stopping $name" + kill "$pid" 2>/dev/null + rm -f "$pidfile" + eend $? +} +``` diff --git a/irc-connect b/irc-connect new file mode 100755 index 0000000..10edc99 --- /dev/null +++ b/irc-connect @@ -0,0 +1,27 @@ +#!/bin/sh + +TIMEOUT=10 +CHANNELSWAIT=1 + +# IRC client connector script +# Usage: irc-connect <server> <nick> <pass> <dir> [channel1] [channel2] ... + +SERVER="$1" +NICK="$2" +PASS="$3" +DIR="$4" +shift 4 + +ii -s "$SERVER" -n "$NICK" -i "$DIR" -e & +II_PID=$! +sleep "$TIMEOUT" +echo "IDENTIFY $NICK $PASS" >"$DIR"/"$SERVER"/nickerv/in +sleep $CHANNELSWAIT + +# Join all provided channels +for channel in "$@"; do + echo "/j $channel" >"$DIR"/"$SERVER"/in + sleep "$CHANNELSWAIT" +done + +wait $II_PID diff --git a/lchat-connect b/lchat-connect new file mode 100755 index 0000000..e9a6ba2 --- /dev/null +++ b/lchat-connect @@ -0,0 +1,10 @@ +#!/bin/sh + +# lchat connector script +# Usage: lchat-connect <dir> <server> <channel> + +DIR="$1" +SERVER="$2" +CHANNEL="$3" + +lchat -a "$DIR"/"$SERVER"/"$CHANNEL" \ No newline at end of file diff --git a/services/lispirc b/services/lispirc new file mode 100755 index 0000000..a8c3f11 --- /dev/null +++ b/services/lispirc @@ -0,0 +1,33 @@ +#!/sbin/openrc-run + +name="lispirc" +description="IRC client for #lisp on irc.libera.chat" + +command="/home/jose/src/sh/irc-connect" +command_args="(irc.libera.chat) <YOUR NICKSERV IDENT> <YOUR NICKSERV PASSWORD> <IRC FILES PATH> CHANNELS CHANNELS CHANNELS (eg. \#lisp)" +command_user="jose:jose" +pidfile="/run/${RC_SVCNAME}.pid" +command_background="yes" + +depend() { + need net + after logger +} + +stop() { + if [ -f "$pidfile" ]; then + local pid=$(cat "$pidfile") + ebegin "Stopping $name" + # Kill the main process and any child processes + pkill -P "$pid" 2>/dev/null + kill "$pid" 2>/dev/null + # Clean up the pidfile + rm -f "$pidfile" + eend $? + else + ebegin "Stopping $name" + # Fallback: kill by process name + pkill -f "irc-connect.*equwal" 2>/dev/null + eend $? + fi +}