LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-20-2014, 08:42 AM   #1
mainstream
Member
 
Registered: Oct 2010
Location: localhost
Distribution: Ubuntu / Linux Mint
Posts: 61

Rep: Reputation: 0
Cool (X)Ubuntu post install script


Hi all,

I created a small post installation (bash) script for Xubuntu, since i grey tired of repeating this steps all the time.
  • It's adding ppa's
  • Installs some apps
  • Adds some system tweaks
  • Adds fonts
  • Etc.network-manager-openvpn

Is there someway i can test/simulate the script without altering any files and see all the output?

Best regards

Last edited by mainstream; 09-20-2014 at 08:45 AM.
 
Old 09-20-2014, 09:03 AM   #2
jkirchner
Member
 
Registered: Apr 2007
Location: West Virginia
Posts: 765

Rep: Reputation: 196Reputation: 196
Set up an installation in a virtual machine and run your script in it. Best way to see if it works all the way through.

Another way would be to use a copy of the script and have it write changes to test files and in place of actual installs just send an echo to terminal or to a file so you can see the steps occuring without actually downloading or installing. If that worked well you could do the VM idea I mentioned first for a full dress rehearsal run, as it were.

Last edited by jkirchner; 09-20-2014 at 09:07 AM.
 
1 members found this post helpful.
Old 09-20-2014, 09:07 AM   #3
mainstream
Member
 
Registered: Oct 2010
Location: localhost
Distribution: Ubuntu / Linux Mint
Posts: 61

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jkirchner View Post
Set up an installation in a virtual machine and run your script in it. Best way to see if it works all the way through.
There's no easier way?
I remember adding a command to the bash script that would simulate the script, but i can't seem to remember it. Something like set -vx
 
Old 09-20-2014, 10:08 AM   #4
mainstream
Member
 
Registered: Oct 2010
Location: localhost
Distribution: Ubuntu / Linux Mint
Posts: 61

Original Poster
Rep: Reputation: 0
Quote:
# install apps
echo Installing apps
sudo apt-get -y install \
git git-core python python-cheetah gksu leafpad gparted tlp \
ppa-purge mdadm leafpad plank openvpn network-manager-openvpn \
sabnzbdplus xbmc vlc clementine libavcodec-extra skype gimp \
p7zip-rar p7zip-full unace unrar zip unzip sharutils rar \
uudeview mpack arj cabextract file-roller linux-headers-generic \
build-essential
I have this in my script. It does, however, not install all the apps?

EDIT: i found it. I skipped installing programs because tlp and skype are not in the repository. Is there any way to install the other program when a program is not in the repository?

Last edited by mainstream; 09-20-2014 at 10:47 AM.
 
Old 09-20-2014, 04:02 PM   #5
ondoho
Senior Member
 
Registered: Dec 2013
Posts: 4,658

Rep: Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987
Quote:
Originally Posted by mainstream View Post
I have this in my script. It does, however, not install all the apps?

EDIT: i found it. I skipped installing programs because tlp and skype are not in the repository. Is there any way to install the other program when a program is not in the repository?
you can install each program with its own apt-get command.
you could also tell your script to add the repositories to install skype.

but by now you should begin to realise that all this is not so simple and running it in a vm is maybe not such a bad idea.
 
Old 09-21-2014, 03:51 AM   #6
mainstream
Member
 
Registered: Oct 2010
Location: localhost
Distribution: Ubuntu / Linux Mint
Posts: 61

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ondoho View Post
you can install each program with its own apt-get command.
you could also tell your script to add the repositories to install skype.

but by now you should begin to realise that all this is not so simple and running it in a vm is maybe not such a bad idea.
Indeed thanks but it's more a fallback when a app is not available, it continues with the rest.
I only need something to report it when it's not installed - any tips?

Output is E: Unable to locate package $app

You mean running in a loop?

Code:
INSTALL="skype tlp vlc xbmc openvpn etc"
for app in $INSTALL
do
	echo "Processing $app"
	sudo apt-get -y install $app
done

Last edited by mainstream; 09-21-2014 at 03:55 AM.
 
Old 09-21-2014, 06:20 AM   #7
ondoho
Senior Member
 
Registered: Dec 2013
Posts: 4,658

Rep: Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987
yes.
i guess i'd just put the apt-get commands there one by one, but yours is more flexible and easier to change.
 
Old 09-21-2014, 08:34 AM   #8
mainstream
Member
 
Registered: Oct 2010
Location: localhost
Distribution: Ubuntu / Linux Mint
Posts: 61

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ondoho View Post
yes.
i guess i'd just put the apt-get commands there one by one, but yours is more flexible and easier to change.
Thanks, but how can i check the output from the loop?
So i can see which app didn't install?
 
Old 09-25-2014, 01:45 AM   #9
ondoho
Senior Member
 
Registered: Dec 2013
Posts: 4,658

Rep: Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987
if you run the script from a terminal, it will show the output, just like running the command manually.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Help to create a slackbuild from post-install.py script theCapitain Slackware 4 09-07-2010 04:15 PM
Handling Kickstart post-install script GUI adrianmarsh Red Hat 4 08-10-2009 10:37 PM
GRUB install problems... (post windows install on ubuntu) sersdf Linux - Software 4 02-27-2009 08:59 AM
ubuntu post install ptawe Ubuntu 5 03-24-2006 03:35 PM
Ubuntu/Kubuntu post install ptawe Ubuntu 4 02-26-2006 06:50 AM


All times are GMT -5. The time now is 06:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration