2016-11-14 17:42:14 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
case $OSTYPE in
|
|
|
|
darwin*)
|
|
|
|
brew install weechat
|
|
|
|
;;
|
|
|
|
linux*)
|
|
|
|
if [[ -d /etc/arch-release ]]; then
|
|
|
|
sudo pacman --needed --noconfirm -S weechat
|
|
|
|
elif [[ -d /etc/debian_version ]]; then
|
|
|
|
# TODO Untested
|
|
|
|
sudo apt-get install -y weechat
|
|
|
|
fi
|
|
|
|
esac
|
|
|
|
|
|
|
|
# If this exists, it's already configured
|
|
|
|
[[ -f ~/.weechat/sec.conf ]] && exit
|
|
|
|
|
2016-12-25 16:17:26 -08:00
|
|
|
if [[ -f ~/.private/config/irc.conf ]]; then
|
2016-11-14 17:42:14 -08:00
|
|
|
# ...otherwise, configure it!
|
|
|
|
CWD=$(cd $(dirname $0) && pwd -P)
|
|
|
|
weechat -r "/set plugins.var.fifo.fifo on'" &
|
|
|
|
PID=$?
|
|
|
|
|
|
|
|
while ! pgrep weechat >/dev/null; do sleep 1; done
|
2016-12-25 16:17:26 -08:00
|
|
|
wee "$HOME/.private/config/irc.conf"
|
|
|
|
wee "$CWD/settings.txt"
|
2016-11-14 17:42:14 -08:00
|
|
|
wee "$CWD/servers.txt"
|
|
|
|
kill $PID
|
|
|
|
else
|
|
|
|
>&2 echo "Couldn't find secrets!"
|
|
|
|
exit 1
|
|
|
|
fi
|