Allow for setting nick when using help option.

This commit is contained in:
Storm Dragon 2022-04-10 23:30:56 -04:00
parent 1be56e4fc0
commit afe8a28671

View File

@ -1,5 +1,13 @@
#!/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
@ -9,7 +17,9 @@ fi
if [[ ! -d ~/.stormux_irssi ]]; then
{ fileName="$(mktemp --suffix .txz)"
wget -O "$fileName" "https://stormux.org/downloads/.stormux_irssi.txz"
tar xf "$fileName" -C ~/; } | dialog --progressbox "Configuring irssi..." -1 -1
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