Start a Conversation

Unsolved

This post is more than 5 years old

B

332679

September 6th, 2013 14:00

How to: Create a Desktop shortcut that launches your app and uses your username and password settings without opening a terminal on your Linux client.

I was going to add this as a KB article, but submitting it failed for some reason and I haven't time to "contact support" about it.  I therefore place this here, in the community since I figure this much effort in figuring out how to do this should not have to be repeated by someone else.  I hope someone finds this article useful.  I have also attatched a copy of vwhelper- the script I mention in the article.  It ends in .txt, but should one want to use it one will likely want to rename it to just vwhelper once it is copied to a linux machine.  It will also need to be set executable as mentioned in the article.  The programs nano, dos2unix and zenity need to be installed on one's linux machine in order for this to work. 

Before I begin, I want to give the following credit to Andrew for kb article 102695 https://support.quest.com/SolutionDetail.aspx?ID=102695

Some of this article will be shamelessly plagiarized from this previous article.  I would also like to note that I this article assumes a Gnome desktop and the vWorkspace .rpm package.  The locations for some of the files may be different for the .deb version of vworkspace.  I mention this only as a precaution as the .deb version was never tested by me, the locations may also be the same. Lastly, this article assumes a single domain for logging on, and therefore never asks the user for a domain, just their username and password.  If users log onto multiple domains through this client, modifications will have to be made to the script to account for this.  There should be enough in the script to act as a template for this.

This article also assumes that one has already tested the client using either the vWorkspace Launcher, and can verify that vWorkspace is properly installed and configured to make a connection, and that the connection broker is properly configured to accept one.

How to: Create a Desktop shortcut that launches your app and uses your username and password settings without opening a terminal.

Step A, Creating the PIT file

  1. On a Windows machine, open PNTSC
  2. Set the settings that you'd like to use and then click save as and then name the file (I used the name linux.pit, but you can call it whatever you want, you'll just have to edit some things below later on).
  3. Copy the .pit file to a Linux box (in this example, to /usr/local/share/applications/linux.pit  It could be anywhere, but this is where I put it).  I recommend installing ssh-server on your linux box and using WinSCP to copy the files.  Makes it easy.
  4. In a Linux Terminal run the command dos2unix -f /usr/local/share/applications/linux.pit

(The /usr/local/share/applications/linux.pit is the path and file name, obviously this will be different for you if you put the file somewhere else or gave it a different name.)

Step B, Create the Script

All of the following will be done as the root user:

  1.     Open a Terminal Window

  2.     Run the Command nano /usr/local/bin/vwhelper (you can call this script whatever you want, and put it anywhere you want, but this is where I put it and what I named it.)

  3.     Once in nano, copy the following into the file:

#!/bin/bash

USERN=`zenity --entry --title="User Name" --text="Please Enter Your User Name"`;

if [ -z "$USERN" ]

then

       zenity --error --title="Empty User Name" --text="User name  was empty, please run the program again."

exit

else

PASS=`zenity --entry --title="Password" --text="Please Enter Your Password" --hide-text`;

if [ -z "$PASS" ]

then

       zenity --error --title="Empty Password" --text="Password was empty, please run the program again."

exit

else

/usr/local/bin/pntsc http://cb:8080 -a "RDSH" -u $USERN -p $PASS -d DomainName -f '/usr/local/share/applications/linux.pit' 2>&1 | zenity --text-info --title="vWorkspace" --timeout=15 ;

fi

fi

In step 3, the http://cb:8080 needs to be changed to http://your connection broker name:8080

the "RDSH" needs to be changed to the application name that you wish to launch.

the -d DomainName needs to be changed to your domain name

the -f /usr/local/share/applications/linux.pit needs to be changed to the path and filename of your pit file.

When the necessary edits are made, do a CTRL-O to write the file, followed by a CTRL-X to exit out of nano.

Finally, make the script executableby typing  chmod +x /usr/local/share/applications/vwhelper (again your filename and path may vary, but this gives you the example).

This script creates a GUI to pass the username and password to pntsc and also redirects sdout and sderr of pntsc to a graphical information window in order to give the user an idea of whether they put their username or password in correctly, whether the vm is powering up (in the case of parallels or some other vm-application), or whether there is some other issue.  The info window will close after 15 seconds, but of course, if one needs more time for tasks to complete, that can be adjusted in the script after the --timeout= switch.  it can also be manually closed by the user.  Putting blank entries in either username or password fields terminates the script before pntsc is invoked, and the user is prompted to run the program again.

Step C, Create the shortcut

1. Open a Terminal Window

2. Run the Command gnome-desktop-item-edit Desktop --create-new

3. Select type "Application"

     a) Give it a name

     b) Give it a command /usr/local/bin/vwhelper

4.You can click on the Icon in the left hand corner whilst creating the shortcut to pick a different .png file for the shortcut. I use the one provided by the .rpm package at /usr/local/share/pixmaps/vworkspace.png

You now have a user friendly icon that will launch vWorkspace just like it does in Windows. 

1 Attachment

January 16th, 2015 08:00

Thanks for the update. Good work.

No Events found!

Top