Cool solution: Linux login to NetWare script

Opinion
Jun 2, 20053 mins

* A NetWare Cool Solutions contribution from Mehmet Duran

I found something that you can do while waiting for Novell to release its long anticipated NCP client for Linux desktops (due out by the end of June).

Recently posted to the NetWare Cool Solutions Web site (https://www.novell.com/coolsolutions/netware/) is a contribution from NetWare user Mehmet Duran called, simply, “Linux Login to NetWare Script.”  And that’s what it is: a Bash shell script.

You can download Duran’s script (https://www.novell.com/coolsolutions/tools/downloads/loginnw.sh) but it’s short enough for me to print it all here. I would not suggest you cut and paste this, however, as formatting (and formatting marks) will cause it to not execute properly. Still, you can get an idea of how it works. Re-type it into your Linux desktop, or simply ignore this and download the actual script. After saving the file to your Linux system, run it with the command “sh loginnw.sh” in a console window, or make it executable by issuing the command “chmod u+x loginnw.sh”. 

The script itself is:

#/bin/bash

#Clear the screen, reads easier

clear

#Check if ncpmount exists.

if test ! -e /usr/bin/ncpmount

 then echo “ncpmount isn’t found, check if it exists in /usr/bin/ncpmount”

else

 echo “ncpmount exist”

fi

#Check if ncpmount is executable.

if test ! -x /usr/bin/ncpmount

 then echo “ncpmount isn’t executable”

 echo “login as root and enter the next command”

 echo “chmod 4755 /usr/bin/ncpmount”

 echo “Script will be exited”

 exit

else

 echo “ncpmount is executable, so we will continue”

fi

#Ask questions

  echo “Enter the name of the server, the folder that will be created will have the same name”

 read NWSVR

  echo “Enter the IP Address, example 192.169.1.1”

 read NWIP

  echo “Enter your full loginname, begin with a leading period, example .jdoe.test.name”

 read NWUSER

echo “Please check for errors”

sleep 3

#Clean screen again

clear

echo Your servername is $NWSVR

echo The IP address of your server is $NWIP

echo Your username is $NWUSER

#Let the user check the answers

agreed=

    while [ -z “$agreed” ]; do

        echo

        echo “Is the entered information correct? [yes or no]”

        read reply leftover

        case $reply in

            y* | Y* | j* | J* )

                agreed=1

                echo “Next we will try to make a connection”

  ;;

            n* | N*)

                echo “Please restart “;

                exit 1

                ;;

        esac

done

#Check if directory exists

if [ -d ~/$NWSVR ]

 then echo “Folder $NWSVR exists, we will use this folder”

else

mkdir ~/$NWSVR

 echo “Folder doesn’t exist, but we made one”

fi

#Here we go, cross your fingers

ncpmount -S $NWSVR -A $NWIP -U $NWUSER -m ~/$NWSVR

ls ~/$NWSVR

Have fun with it.