summaryrefslogtreecommitdiff
path: root/bin/ii-connect
blob: 1e09d115b4126dff3c20206c6a1dadb7ffe453c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

# identify to nickserv and log in to the correct irc channels

# shellcheck disable=SC2119,SC2120

# shellcheck source=../lib/load-configuration
. "${0%/*}/../lib/load-configuration"

# wait for nickserv complaint
while ! grep -qF 'This nickname is registered. Please choose a different nickname' "${irc_dir}/nickserv/out"; do
  sleep 1
done

# wait for registering to succeed
while ! grep -q 'You are \(now identified for\|already logged in as\) ' "${irc_dir}/nickserv/out"; do
  # register
  printf 'identify %s\n' "${irc_password}" | \
    sponge "${irc_dir}/nickserv/in"
  sleep 5
done

# join channels
printf '/j #archlinux32%s\n' '' '-devops' | \
  sponge "${irc_dir}/in"