From afe8a28671a9f7143c1759d91f5f4cbd3b8b9d41 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 10 Apr 2022 23:30:56 -0400 Subject: [PATCH] Allow for setting nick when using help option. --- .includes/irc.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.includes/irc.sh b/.includes/irc.sh index 358d8aa..448bed5 100755 --- a/.includes/irc.sh +++ b/.includes/irc.sh @@ -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