PDA

View Full Version : bash scripting questions



miesnerd
September 23rd, 2008, 11:43 AM
So im writing a bash script for a friend, so that when he gets ibex he'll be able to install everything and have it set up the way I want it to be done.
As Im not great at bash scripting, I have some questions.

If I want my script to go out append some sources to the sources.list then grab packages, how do I do that in the script?
What about enabling extra repos in the script?

If you have any other suggestions or a script that does this already that I could look at for better ideas, I'd love to use that as a reference.

Miesnerd

miesnerd
September 23rd, 2008, 12:18 PM
also
I am using the package download script that's generated by synaptic. After it downloads the packages to a folder, can I just apt-get install -i* .deb to install all the files?

_oOMOo_
September 23rd, 2008, 12:31 PM
also
I am using the package download script that's generated by synaptic. After it downloads the packages to a folder, can I just apt-get install -i* .deb to install all the files?

Not sure if you already know this but you can use:


dpkg --get-selections > myselections

to output a list of your installed packages into a file, then read the file just created into dpkg on the new machine to replicate the installed packages..



sudo apt-get update
sudo dpkg --set-selections <myselections
sudo apt-get -u dselect-upgrade


from http://lists.samba.org/archive/linux/2002-June/003399.html

miesnerd
September 23rd, 2008, 12:33 PM
Not sure if you already know this but you can use:


dpkg --get-selections > myselections

to output a list of your installed packages into a file, then read the file just created into dpkg on the new machine to replicate the installed packages..



sudo apt-get update
sudo dpkg --set-selections <myselections
sudo apt-get -u dselect-upgrade


from http://lists.samba.org/archive/linux/2002-June/003399.html

no man, i totally dont know this. So im confused about what goes in myselections? There are going to be a lot of packages in here. Do I list all of them? I'll give that link a read. Thanks.

miesnerd
September 23rd, 2008, 12:34 PM
So what you're saying, then is to set up my system exactly how his is going to be, and then copy all the configs and make that into a script?

_oOMOo_
September 23rd, 2008, 12:38 PM
So what you're saying, then is to set up my system exactly how his is going to be, and then copy all the configs and make that into a script?

Yes it'll create a list of your packages in the file myselections which you can then read into the new machine, if you want the same packages installed as you have on your machine. I think I may have misunderstood your intention.

Having said that you should be able to edit the myselections file to remove packages you think he won't need for instance.

_oOMOo_
September 23rd, 2008, 12:45 PM
This thread http://ubuntuforums.org/showthread.php?t=169062 gives a bit more detail esp with regard to creating a cd with packages on. Hope it helps.