configure-stormux/.includes/irc.sh

29 lines
978 B
Bash
Executable File

#!/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
# 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)"
curl --output "$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
fi
# Launch irssi
irssi --home ~/.stormux_irssi
exit 0