Should include this since irssi is a ShadowArch default

This commit is contained in:
DarkFeather 2016-11-18 15:01:36 -06:00
parent 79cb6555cf
commit b400bbafb2
2 changed files with 70 additions and 1 deletions

View File

@ -1,4 +1,4 @@
LIST=bell bigorlittle compare-directories compress-all diff-args expand-all logged-shell standardize-folder whatismyip
LIST=bell bigorlittle compare-directories compress-all diff-args expand-all logged-shell standardize-folder whatismyip new-irssi-config
LOCATION=/usr/local/bin
PERMISSION=0755
compile:

69
Shared/new-irssi-config Executable file
View File

@ -0,0 +1,69 @@
#!/bin/bash
function prompt-var() {
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Need a variable name (1) and a prompt string (2)"
return 1;
fi
unset $1
while [ "${!1}" == "" ]; do
printf "%s " "$2";
read $1;
done
return 0;
}
# This function will prompt the user for variable 1 with string 2 until it gets a nonempty answer.
function prompt-password() {
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Need a variable name (1) and a prompt string (2)"
return 1;
fi
unset $1
while [ "${!1}" == "" ]; do
printf "%s " "$2";
read -s $1;
echo
done
return 0;
}
#This function will prompt the user for a variable 1 with string 2 until it gets an answer between min 3 and max 4.
function prompt-num-var() {
if [ -z "$1" ] || [ -z "$2" ] || [ "$3" -ne "$3" ] || [ "$4" -le "$3" ]; then
echo "Need a variable name (1), prompt string (2), min (3), and max (4)";
echo 1: $1;
echo 2: $2;
echo 3: $3;
echo 4: $4;
return 1;
fi
unset $1
while [ "${!1}" == "" ] || [ "${!1}" -lt "$3" ] || [ "${!1}" -gt "$4" ]; do
printf "%s " "$2";
read $1;
done
return 0;
}
# Needed information
prompt-var NETWORKNAME "What is the network name? "
prompt-var IRCADDRESS "What is the IRC address? "
prompt-num-var IRCPORT "What port is listening? " 1 65535
prompt-var CHANNELNAME "What is the first channel to join? "
prompt-var USERNAME "What username do you use on this network? "
prompt-password NICKSERVPASS "What is your password to NickServ?"
prompt-password SERVERPASS "What is the server password? (Enter nopass if no password)"
# Create the config;
cp -r /etc/skel/.irssi ./.irssi-"$NETWORKNAME"
cd ./.irssi-"$NETWORKNAME"
if [ "$SERVERPASS" != "nopass" ]; then
sed -i "s@address = \"IRCADDRESS\";@address = \"IRCADDRESS\";\n password = \"$SERVERPASS\";@" config
fi
sed -i "s@NETWORKNAME@$NETWORKNAME@g" config
sed -i "s@IRCADDRESS@$IRCADDRESS@g" config
sed -i "s@IRCPORT@$IRCPORT@g" config
sed -i "s@CHANNELNAME@$CHANNELNAME@g" config
sed -i "s@USERNAME@$USERNAME@g" config
sed -i "s@REALNAME@$USERNAME@g" config
sed -i "s@NICKSERVPASS@$NICKSERVPASS@g" config
echo
echo "Run \"irssi --home=$PWD\" to start your new config."