#!/bin/bash
SHORTCUTDIR="digir0x"
CURRENTIP="199.1.22.12"
echo "AutoLogin Site Script Generator (c) digivamp, v3.0 - 4:20 1998"
echo -n "Full Site Name: "
read SITENAME
echo -n "Site Abbreviation (2-3 CHARS): "
read ABBRV
echo -n "IP/NAME(XX.XXX.XXX.X / blah.net): "
read IP
echo "Making Sure Im adding an IP Address ..."
# nslookup $IP > tmpfile
# defip=`tail -n 2 tmpfile | cut -b 11-25`
defip=$IP
echo "Adding $defip to autoconnection list"
echo "If You Saw: Non-Existent Domain, please Control-C and Start w/ -nodns option."
echo -n "Port: "
read PORT
echo -n "Login: "
read LOGIN
echo -n "Password: "
read PASSWORD
echo -n "Default Directory to change to (ie: /uploads/utils): "
read DEFDIR
echo "Switching to $DEFDIR upon login to $SITENAME"
echo "Automatically Switch to BINARY mode."
echo "machine $defip	login $LOGIN	password $PASSWORD" >> .netrc
echo "macdef init" >> .netrc
echo "cd $DEFDIR" >> .netrc
echo "bin" >> .netrc
echo "" >> .netrc
echo "echo Testing connection to $SITENAME" >> $SHORTCUTDIR/$ABBRV
echo "ftp -i $defip $PORT" >> $SHORTCUTDIR/$ABBRV
chmod u+x $SHORTCUTDIR/$ABBRV
echo "All Set! Type $ABBRV to connect to $SITENAME"
echo "Remember, type autoin -commands for a command list."
echo "Cleaning up any mess i have left behind ..."
# remove the temp file from the IP Finder
del tmpfile

