summaryrefslogtreecommitdiff
path: root/bin/ii-connect
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-07-18 11:53:57 +0200
committerErich Eckner <git@eckner.net>2018-07-18 11:53:57 +0200
commit8fd41a4a2f07b4a5f4f08f4cc4a3ee77d51c13a2 (patch)
tree611d5373e715bb6349464bf89d0e41fd761903cf /bin/ii-connect
parent4b440f5df1349a94d91505f162db0bae9c9c22ab (diff)
downloadbuilder-8fd41a4a2f07b4a5f4f08f4cc4a3ee77d51c13a2.tar.xz
bin/ii-connect: make blocking (so it needs to be run only once)
Diffstat (limited to 'bin/ii-connect')
-rwxr-xr-xbin/ii-connect34
1 files changed, 17 insertions, 17 deletions
diff --git a/bin/ii-connect b/bin/ii-connect
index 8d807a9..8081cf0 100755
--- a/bin/ii-connect
+++ b/bin/ii-connect
@@ -1,26 +1,26 @@
#!/bin/sh
-# run and handle the irc client
+# identify to nickserv and log in to the correct irc channels
# shellcheck disable=SC2119,SC2120
# shellcheck source=../lib/load-configuration
. "${0%/*}/../lib/load-configuration"
-# register if not yet done
-if tail -n1 "${irc_dir}/nickserv/out" 2> /dev/null | \
- grep -qF 'This nickname is registered. Please choose a different nickname'; then
- printf 'identify %s\n' "${irc_password}" | \
- sponge "${irc_dir}/nickserv/in"
-fi
+# wait for nickserv complaint
+while ! grep -qF 'This nickname is registered. Please choose a different nickname' "${irc_dir}/nickserv/out"; do
+ sleep 1
+done
-# join #archlinux32 if not yet done
-if ! grep ' archlinux32/bot/buildmaster .* buildmaster$' "${irc_dir}/out" | \
- tail -n1 | \
- grep -q ' #archlinux32 '; then
- {
- echo '/j #archlinux32'
- echo '/WHO buildmaster'
- } | \
- sponge "${irc_dir}/in"
-fi
+# register
+printf 'identify %s\n' "${irc_password}" | \
+ sponge "${irc_dir}/nickserv/in"
+
+# wait for registering to succeed
+while ! grep -qF 'You are now identified for' "${irc_dir}/nickserv/out"; do
+ sleep 1
+done
+
+# join channel
+echo '/j #archlinux32' | \
+ sponge "${irc_dir}/in"