summaryrefslogtreecommitdiff
path: root/bin/ii-connect
blob: 8d807a9ebbde3502e522617a63e49d9f82134b9e (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
26
#!/bin/sh

# run and handle the irc client

# 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

# 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