Please note that LinuxExchange will be shutting down on December 31st, 2016. Visit this thread for additional information and to provide feedback.

This is a script I wrote that you can run right after you install Ubuntu 10.04LTS (Desktop Edition). It adds some 3rd party applications, repositories, configures iptables and so forth. One thing I'd like it to do is detect if it's being ran on a 32-bit or 64-bit system and then either download the w32codes or the w64codes accordingly.

I'm also open to any other ideas and/or suggestions.

I've updated this code a few times, incorporating suggestions from people to the point that there's more code than what I am allowed to paste here, si I've moved the code off-site to a Pastebin log at:

http://pastebin.com/3B9K5Fyp

1) Does anyone see anything else I can do too?

2) Another thing I was thinking of adding was my own repository for files like fonts, images, PDFs, etc and loading them into the appropriate places .I do have a Lanchpad account, but I'm not a packager/programmer by nature. I'm a network / os / security guy, not a developer. I'd like to make some sort of all-inclusive *.deb file that people can download from my repo and it'd update wallpapers, documents, programs, etc.

Right now as you can see, I'm using Dropbox as a repo of sorts.

So in addition to my on-going question of how to improve the script and the above new things, I need to add this:

3) Is there a way I can test my script without loading it onto a new PC? A sort of "simulation mode" per se?

I've ran into a couple of issues where during the install, I must select choices (like to accept the EULA for Java, or to enable or disable a daemon, etc), and I'd like to automate that process somehow for testing purposes.

Lastly, but most importantly, I'd like to thank everyone for their suggestions, as you have helped me make this a better script.

This question is marked "community wiki".

asked 04 Jun '10, 17:43

Ron's gravatar image

Ron ♦
9361718
accept rate: 13%

edited 03 Jan '11, 21:02

Please accept an answer so the question/answer can be finished. Or provide more details so we can help.

(20 Apr '11, 14:21) rfelsburg ♦



You can get information about your system using uname. uname -m could for example return i686, x86_64, ... depending on your system.

You might also want to check the return values of certain commands. Writing a function that checks the last return value ($?) and handles/logs errors accordingly would be an easy solution for that.

A good source of ideas is the Advanced Bash-Scripting Guide.

link

answered 04 Jun '10, 19:48

Jazz's gravatar image

Jazz ♦
7811312
accept rate: 33%

Thanks. I will look into that as well. Someone even suggested to me (via IRC) that maybe I should package this and setup a PPA.

(04 Jun '10, 20:26) Ron ♦

replace the lines to add the PPAs with add-apt-repository ppa:/ (ex: add-apt-repository ppa:exaile-devel/ppa) this will also add the keys.

you can also replace the deb lines with it (ex: add-apt-repository deb http://www.geekconnection.org/remastersys/repository karmic)

link

answered 05 Jun '10, 22:54

mackal's gravatar image

mackal
913
accept rate: 0%

The one for Remastersys must remain that way for now, but I did change the others, thank you for the suggestion.

(07 Aug '10, 06:23) Ron ♦

You forgot to run apt-get upgrade after running apt-get update.

Also, you are making a backup of sources.list after adding your new repos to it. Is that on purpose?

Is this something you are running on several machines in an enterprise evironment? If so, I highly recommend dropping the custom scripts and using puppet instead. It is a total lifesaver.

link

answered 05 Jun '10, 05:25

Joehillen's gravatar image

Joehillen
1462512
accept rate: 40%

1

You forgot to run apt-get upgrade after running apt-get update. - I'll add that

Also, you are making a backup of sources.list after adding your new repos to it. Is that on purpose? - Yes

Is this something you are running on several machines in an enterprise evironment? - No

If so, I highly recommend dropping the custom scripts and using puppet instead. It is a total lifesaver. - Agreed

(06 Jun '10, 15:31) Ron ♦

That is a rather fine script. Thanks for sharing.

Add gshutdown, monkey-bubble, and tuxpaint?

link

answered 04 Jun '10, 19:42

Dee's gravatar image

Dee
411
accept rate: 0%

I will look into those applications. Thanks for the suggestions :)

(04 Jun '10, 20:25) Ron ♦

gshutdown and monkey-bubble have now been added to the script due to Dee's suggestion. Thanks again Dee :)

(04 Jun '10, 22:09) Ron ♦

To add to the list I would set PATH at the beginning, or set your commands to variable names.

export PATH=/bin:/usr/bin:/sbin:/usr/sbin

or

_iptables=/bin/iptables
$_iptables -P FORWARD DROP
$_iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
link

answered 13 Jul '10, 19:27

rfelsburg's gravatar image

rfelsburg ♦
6061618
accept rate: 25%

Ok, not quite sure where/how to do that at. I'm new to bash scripting.

(15 Jul '10, 21:54) Ron ♦

It would be added to the top of your script.

Setting the commands to a variable just cleans up the code a bit, nothing crucial. Setting the path however, designates where your script will look for any executables that aren't coded with an absolute path.

(27 Jul '10, 15:08) rfelsburg ♦

Added and done. Thank you for the suggestion. You have helped improve the script.

(07 Aug '10, 06:24) Ron ♦

It could be improved by making use of looping. This allows separating out of the highly changeable items, like the list of applications, by putting them in variables or even reading them from an include script. For example:

REMOVE_APPS=(amarok empathy gimp gufw gwibber transmission-gtk)

for a in "${REMOVE_APPS[@]}"; do
    apt-get --yes -q --force-yes remove "$a"
done
link

answered 17 Dec '13, 00:29

KenJackson's gravatar image

KenJackson
5113
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×81
×16
×14
×9
×8

Asked: 04 Jun '10, 17:43

Seen: 3,530 times

Last updated: 17 Dec '13, 00:29

powered by OSQA