configure-stormux/.includes/irc.sh

29 lines
972 B
Bash
Raw Normal View History

2022-04-10 19:23:48 -04:00
#!/bin/bash
# Get nick
if [[ ! -d ~/.stormux_irssi ]]; then
nick="$(inputbox "Please enter a username to be used when chatting. This is what other people will see when you type something. Only letters, numbers, dashes and underscores.")"
if ! [[ "$nick" =~ ^[a-z][-a-z0-9]*$ ]]; then
nick="stormux_$(uname -m)"
fi
fi
2022-04-10 19:23:48 -04:00
# Make sure irssi is installed
if ! command -v irssi &> /dev/null ; then
install_package irssi | dialog --progressbox "Installing irssi..." -1 -1
fi
# check for Stormux specific irssi config
if [[ ! -d ~/.stormux_irssi ]]; then
{ fileName="$(mktemp --suffix .txz)"
wget -O "$fileName" "https://stormux.org/downloads/.stormux_irssi.txz"
tar xf "$fileName" -C ~/
sed -i -e "s/user_name = \"stormux\";$/user_name = \"$nick\";/" -e "s/nick = \"stormux\";$/nick = \"$nick\";/" ~/.stormux_irssi/config
} | dialog --progressbox "Configuring irssi..." -1 -1
2022-04-10 19:23:48 -04:00
fi
# Launch irssi
irssi --home ~/.stormux_irssi
exit 0