PDA

View Full Version : Please help me in shell scripting



praveesh
August 9th, 2009, 02:17 PM
I have created an add on cd(with the help of aptoncd ) for Ubuntu with some apps for my friend. I wish to create a bash script to be included in the cd, such that after the cd is added to the repository , my friend need to just double click on the shell script and click on run(not run in terminal). Please help me in this by providing the shell script. Is it possible to run a script without opening a terminal emulator?(ie without using cd /cdrom; ./script). Will a gksudo help?. Please provide me script preferably with gksudo . Please assume the packages to be installed be A,B,C,D . Thanks in advance.

praveesh
August 9th, 2009, 02:24 PM
Two more doubts .
1.Is there any command to add the cdrom to the repository
2. Is there any command to know the directory in which the shell script exists.

kevdog
August 9th, 2009, 03:25 PM
You might want to take a look at zenity.

praveesh
August 9th, 2009, 03:36 PM
You might want to take a look at zenity.
what is zenity?please explain.

andru183
August 9th, 2009, 03:41 PM
ya i need how help starting out with bash if anyone knows somewhere to teach me?

Greg
August 9th, 2009, 03:49 PM
what is zenity?please explain.

Zenity is a dialog system for shell scripting.

What you'd have to do is write the script, then decide if it needs root access. If it needs root access, then when you make the desktop icon, you need gksu or something similar. You need to make sure that the script is chmod'ed to +x, of course. I'm pretty sure that you can run a pure shell script from out of a terminal from double clicking and it would just run, but it wouldn't show any output.

praveesh
August 9th, 2009, 03:52 PM
ya i need how help starting out with bash if anyone knows somewhere to teach me?
have a look at my signature. The linux documentation project(http://tldp.org) May help you.

praveesh
August 9th, 2009, 04:15 PM
Zenity is a dialog system for shell scripting.
What you'd have to do is write the script, then decide if it needs root access. If it needs root access, then when you make the desktop icon, you need gksu or something similar. You need to make sure that the script is chmod'ed to +x, of course. I'm pretty sure that you can run a pure shell script from out of a terminal from double clicking and it would just run, but it wouldn't show any output.
thanks . But what I don't know is shell scripting . Sudo apt-get install A B C D didn't work(assume the packages to be installed be A,B,C and D)

JohnFH
August 9th, 2009, 04:54 PM
thanks . But what I don't know is shell scripting . Sudo apt-get install A B C D didn't work(assume the packages to be installed be A,B,C and D)

You need to add the CD to your software sources first. Do this by going to System > Administration > Software Sources. Select the 'Third Party Software' tab and click the 'Add CDROM...' button. After adding the CD to your software sources you can then install your packages with sudo apt-get install A B C D as usual.

T-Train
August 9th, 2009, 05:11 PM
I would suggest looking into creating your own CD. This will allow you add a repository during the initial install. The programs you want to add will be available at first boot. You can automate the entire install to run without and prompts if you desire. I created a CD not long ago and it wasn't very hard. There are not a lot of examples around but once you understand the process it is simple. Take a look at the instructions. I would of course suggest testing you new image virtually with VirtualBox or VMware.

https://help.ubuntu.com/community/InstallCDCustomization

JohnFH
August 9th, 2009, 07:56 PM
I would suggest looking into creating your own CD. This will allow you add a repository during the initial install. The programs you want to add will be available at first boot. You can automate the entire install to run without and prompts if you desire. I created a CD not long ago and it wasn't very hard. There are not a lot of examples around but once you understand the process it is simple. Take a look at the instructions. I would of course suggest testing you new image virtually with VirtualBox or VMware.

https://help.ubuntu.com/community/InstallCDCustomization

erm ... he has already created a repository CD using aptoncd. Read the first post.

T-Train
August 9th, 2009, 11:55 PM
Thanks for pointing out the obvious. I was just suggesting a different option.

praveesh
August 10th, 2009, 02:30 AM
I would suggest looking into creating your own CD. This will allow you add a repository during the initial install. The programs you want to add will be available at first boot. You can automate the entire install to run without and prompts if you desire. I created a CD not long ago and it wasn't very hard. There are not a lot of examples around but once you understand the process it is simple. Take a look at the instructions. I would of course suggest testing you new image virtually with VirtualBox or VMware.
https://help.ubuntu.com/community/InstallCDCustomization
thanks for the information. Iam planning to do that . But now , I don't have time . I have to give the cd immediately.

andru183
August 10th, 2009, 03:12 PM
have a look at my signature. The linux documentation project(http://tldp.org) May help you.

dude big help thanks!

Tibuda
August 10th, 2009, 03:19 PM
2. Is there any command to know the directory in which the shell script exists.


dirname $0

phrostbyte
August 10th, 2009, 03:58 PM
These forums have a programming section. It's probably better to ask there. :)

http://ubuntuforums.org/forumdisplay.php?f=39