Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-07-12 10:20:55 +0200
committerErich Eckner <git@eckner.net>2019-07-12 10:20:55 +0200
commit3aba0aefe8beed8d5f69aa942242b447f96887fc (patch)
treece5e99d4a5e78630853d83b49abe5875718fe8f0 /bin
parent8f7ac2897605d8ed0bd871a3bde41cd673958180 (diff)
bin/nit-picker: make irc optional (for testing purposes)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nit-picker68
1 files changed, 44 insertions, 24 deletions
diff --git a/bin/nit-picker b/bin/nit-picker
index 63f71aa..3e927a5 100755
--- a/bin/nit-picker
+++ b/bin/nit-picker
@@ -14,39 +14,55 @@
# - check for differences of dependencies between mysql and packages
# - check for installability of packages
-if pgrep -x ii; then
- >&2 'ii is already running - this will not work'
+if [ $# -eq 1 ] && [ "x$1" = 'x-n' ]; then
+ >&2 echo 'not joining irc'
+ irc=false
+ shift
+else
+ irc=true
+fi
+
+if [ $# -ne 0 ]; then
+ >&2 echo 'usage: nit-picker [-n]'
+ >&2 echo ' -n: do not join irc'
exit 1
fi
-rm -rf --one-file-system "${irc_dir}"
+if ${irc}; then
+ if pgrep -x ii; then
+ >&2 echo 'ii is already running - this will not work'
+ exit 1
+ fi
-ii -s irc.freenode.net -n nit-picker -f nit-picker >/dev/null 2>&1 &
-ii_pid=$!
+ rm -rf --one-file-system "${irc_dir}"
-trap 'kill "${ii_pid}"' EXIT
+ ii -s irc.freenode.net -n nit-picker -f nit-picker >/dev/null 2>&1 &
+ ii_pid=$!
-# wait for nickserv complaint
-while ! grep -qF 'This nickname is registered. Please choose a different nickname' "${irc_dir}/nickserv/out"; do
- sleep 1
-done
+ trap 'kill "${ii_pid}"' EXIT
-# register
-printf 'identify %s\n' "${irc_password}" | \
- sponge "${irc_dir}/nickserv/in"
+ # 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 -qF 'You are now identified for' "${irc_dir}/nickserv/out"; do
- sleep 1
-done
+ # register
+ printf 'identify %s\n' "${irc_password}" | \
+ sponge "${irc_dir}/nickserv/in"
-# join channel
-echo '/j #archlinux32' | \
- sponge "${irc_dir}/in"
+ # wait for registering to succeed
+ while ! grep -qF 'You are now identified for' "${irc_dir}/nickserv/out"; do
+ sleep 1
+ done
-while [ ! -f "${irc_dir}/#archlinux32/out" ]; do
- sleep 1
-done
+ # join channel
+ echo '/j #archlinux32' | \
+ sponge "${irc_dir}/in"
+
+ while [ ! -f "${irc_dir}/#archlinux32/out" ]; do
+ sleep 1
+ done
+fi
mysql_load_min_and_max_versions
@@ -93,7 +109,11 @@ while pgrep -x ii >/dev/null; do
printf 'commit %s is missing from repository %s\n' \
"${git_rev}" \
"${git_repo}" \
- | irc_say
+ | if ${irc}; then
+ irc_say
+ else
+ sed 's/^/irc: /'
+ fi
fi
fi
;;