From 47425fdd85c82ccd263b2aba9859e14c4ed64815 Mon Sep 17 00:00:00 2001 From: Stef Dunlap Date: Tue, 23 Aug 2022 22:41:40 -0400 Subject: [PATCH] Customizable start up params --- our.rb | 13 +++++++++---- start.sh | 4 ++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100755 start.sh diff --git a/our.rb b/our.rb index a0e71b8..409be7e 100755 --- a/our.rb +++ b/our.rb @@ -2,6 +2,11 @@ require 'socket' require 'open3' +# configurable environment variables +nick = ENV['OUR_NICK'] || 'our' +channels = ENV['OUR_CHANNELS'] || '#tildetown,#bots' +prefix = ENV['OUR_PREFIX'] || "#{nick}/" + module IRC class User @@ -68,14 +73,14 @@ end end + puts "starting" -i = IRC::User.new 'localhost', 6667, 'our' -i.join '#tildetown' -i.join '#bots' +i = IRC::User.new 'localhost', 6667, nick +channels.split(',').each { |channel| i.join channel } i.hook do |msg| next unless msg.cmd == 'PRIVMSG' target, content = msg.args - next unless content.delete_prefix! 'our/' + next unless content.delete_prefix! prefix cmd, args = content.split(' ', 2) cmd = '/town/our/' + cmd diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..c55d1ae --- /dev/null +++ b/start.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +DIR=$(dirname -- $0) +/usr/bin/bwrap --unshare-all --ro-bind / / --share-net --dev /dev --tmpfs /tmp $DIR/our.rb