Add irssi and tin helper scripts to archive

This commit is contained in:
T. Joseph Carter 2015-10-28 16:47:33 -07:00
parent 4067fed090
commit 4d7b33f79e
2 changed files with 107 additions and 0 deletions

View File

@ -0,0 +1,48 @@
#!/bin/bash
if [[ ! $(dpkg -l irssi 2> /dev/null | grep '^ii') ]]; then
echo "Installing irssi..."
supo apt-get -y update
sudo apt-get -y install irssi &> /dev/null
sudo apt-get -y clean
fi
if [[ $1 == "-n" && $2 ]]; then
nickname=$2
elif [[ $1 == "-n" ]]; then
nickname="0"
elif [[ -f ~/.irssi/a2c.nickname ]]; then
nickname=$(cat ~/.irssi/a2c.nickname)
else
nickname=
fi
while [[ ! $nickname || ! $(grep -i '^[a-z_\-\\^{}|`][a-z0-9_\-\\^{}|`]*$' <<< $nickname) ]]; do
echo -n "Enter a nickname for chat (to change later, use 'a2chat -n'): "
read
nickname=$REPLY
done
mkdir -p ~/.irssi
echo $nickname > ~/.irssi/a2c.nickname
if [[ -f ~/.irssi/startup ]]; then
mv ~/.irssi/startup ~/.irssi/startup.orig
fi
echo -e "/network add -autosendcmd '/join #a2c.chat' Palomino.A2\n/server add -auto -network Palomino.A2 irc.a2central.com\n" > ~/.irssi/startup
if [[ -f ~/.irssi/config ]]; then
cp ~/.irssi/config ~/.irssi/config.orig
fi
irssi -n $nickname
rm ~/.irssi/startup &> /dev/null
if [[ -f ~/.irssi/startup.orig ]]; then
mv ~/.irssi/startup.orig ~/.irssi/startup
fi
rm ~/.irssi/config &> /dev/null
if [[ -f ~/.irssi/config.orig ]]; then
mv ~/.irssi/config.orig ~/.irssi/config
fi

View File

@ -0,0 +1,59 @@
#!/bin/bash
defaultNNTP="news.aioe.org"
defaultGroups="comp.emulators.apple2:\ncomp.sys.apple2:\ncomp.sys.apple2.comm:\ncomp.sys.apple2.marketplace:\ncomp.sys.apple2.programmer:\ncomp.sys.apple2.usergroups:"
if [[ ! $(dpkg -l tin 2> /dev/null | grep '^ii') ]]; then
echo "Installing Tin newsreader..."
sudo apt-get -y update
sudo apt-get -y install tin &> /dev/null
sudo apt-get -y clean
fi
if [[ $1 == "-h" || $1 == "--help" ]]; then
echo "Usage: a2news [-s nntpServerAddress] [-m postingEmailAddress] [otherTinOptions]"
echo " note: for full options, instead use 'tin'"
exit 1
fi
while [[ $1 == "-s" || $1 == "-m" ]]; do
if [[ $1 == "-s" && $2 ]]; then
nntpServer=$2
shift
shift
fi
if [[ $1 == "-m" && $2 ]]; then
emailAddress=$2
shift
shift
fi
done
mkdir -p ~/.tin
if [[ ! -f ~/.newsrc ]]; then
IFS=''; echo -e "$defaultGroups" > ~/.newsrc
fi
if [[ $nntpServer || ! -f ~/.tin/nntp.server ]]; then
[[ ! $nntpServer ]] && nntpServer="$defaultNNTP"
echo "$nntpServer" > ~/.tin/nntp.server
else
nntpServer=$(cat ~/.tin/nntp.server)
fi
if [[ $emailAddress || ! -f ~/.tin/tinrc ]]; then
while [[ ! $emailAddress || ! $(grep "@" <<< $emailAddress) || ! $(grep "\." <<< $emailAddress) ]]; do
echo -n "Enter the email address you want to post as: "
read
emailAddress=$REPLY
done
if [[ -f ~/.tin/tinrc ]]; then
sed -i "s/^mail_address=.*$/mail_address=$emailAddress/" ~/.tin/tinrc
else
echo "mail_address=$emailAddress" > ~/.tin/tinrc
fi
fi
NNTPSERVER=$nntpServer tin -r "$@"