Answers to: How can I improve this install script?http://linuxexchange.org/questions/779/how-can-i-improve-this-install-script<p>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.</p> <p>I'm also open to any other ideas and/or suggestions.</p> <p>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:</p> <p><a href="http://pastebin.com/3B9K5Fyp" rel="nofollow">http://pastebin.com/3B9K5Fyp</a></p> <p>1) Does anyone see anything else I can do too?</p> <p>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.</p> <p>Right now as you can see, I'm using Dropbox as a repo of sorts.</p> <p>So in addition to my on-going question of how to improve the script and the above new things, I need to add this:</p> <p>3) Is there a way I can test my script without loading it onto a new PC? A sort of "simulation mode" per se?</p> <p>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.</p> <p>Lastly, but most importantly, I'd like to thank everyone for their suggestions, as you have helped me make this a better script.</p>enTue, 17 Dec 2013 00:29:35 -0500Answer by KenJacksonhttp://linuxexchange.org/questions/779/how-can-i-improve-this-install-script/3263<p>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:</p> <pre><code>REMOVE_APPS=(amarok empathy gimp gufw gwibber transmission-gtk) for a in "${REMOVE_APPS[@]}"; do apt-get --yes -q --force-yes remove "$a" done </code></pre>KenJacksonTue, 17 Dec 2013 00:29:35 -0500http://linuxexchange.org/questions/779/how-can-i-improve-this-install-script/3263Comment by rfelsburg on Ron's questionhttp://linuxexchange.org/questions/779/how-can-i-improve-this-install-script#2480<p>Please accept an answer so the question/answer can be finished. Or provide more details so we can help.</p>rfelsburgWed, 20 Apr 2011 14:21:45 -0400http://linuxexchange.org/questions/779/how-can-i-improve-this-install-script#2480Answer by Jazzhttp://linuxexchange.org/questions/779/how-can-i-improve-this-install-script/781<p>You can get information about your system using <strong>uname</strong>. <strong>uname -m</strong> could for example return <strong>i686</strong>, <strong>x86_64</strong>, ... depending on your system.</p> <p>You might also want to check the return values of certain commands. Writing a function that checks the last return value (<strong>$?</strong>) and handles/logs errors accordingly would be an easy solution for that.</p> <p>A good source of ideas is the <a href="http://tldp.org/LDP/abs/html/" rel="nofollow">Advanced Bash-Scripting Guide</a>.</p>JazzFri, 04 Jun 2010 19:48:56 -0400http://linuxexchange.org/questions/779/how-can-i-improve-this-install-script/781