LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-24-2013, 11:12 PM   #1
jtso8
Member
 
Registered: Apr 2011
Posts: 38

Rep: Reputation: 0
Scripting Assistance - Automated installation scrip


I am trying to create a script that will:
1) Install the a list of repositories
2) Update the repository listing on my computer
3) Install a few applications

What I have so far will do this, but what I would also like the script to do is run everything automatically. I am using Ubuntu and would like it if after ever repository I didn't have to hit enter and at every installation I didn't have to hit 'y' and they enter. Is there anyway to automate this?

Thank you, Jeff
 
Old 02-25-2013, 09:14 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,520

Rep: Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944
Quote:
Originally Posted by jtso8 View Post
I am trying to create a script that will:
1) Install the a list of repositories
2) Update the repository listing on my computer
3) Install a few applications

What I have so far will do this, but what I would also like the script to do is run everything automatically. I am using Ubuntu and would like it if after ever repository I didn't have to hit enter and at every installation I didn't have to hit 'y' and they enter. Is there anyway to automate this?
Probably. Post what you've written and tried so far, and we'll be glad to help. Check out the "expect" command, which will wait for ("expect") certain things to come across, and answer accordingly. Lots of examples about how to use expect in scripts.
 
Old 02-25-2013, 05:27 PM   #3
jtso8
Member
 
Registered: Apr 2011
Posts: 38

Original Poster
Rep: Reputation: 0
sudo add-apt-repository ppa:rockclimb/netbeans
sudo add-apt-repository ppa:stebbins/handbrake-snapshots
sudo add-apt-repository ppa:wfg/0ad
sudo add-apt-repository ppa:mozillateam/ppa
sudo add-apt-repository ppa:libreoffice/ppa
sudo add-apt-repository ppapenjdk/ppa
sudo apt-add-repository ppa:aims/sagemath
sudo add-apt-repository ppa:kubuntu-ppa/beta
sudo add-apt-repository ppa:n-muench/vl





sudo apt-get update



sudo apt-get install sagemath-upstream-binary
sudo apt-get install 0ad
sudo apt-get install handbrake-gtk
sudo apt-get install cantor
sudo apt-get install ubuntu-restricted-extras
sudo apt-get install vlc vlc-plugin-pulse mozilla-plugin-vlc
sudo apt-get install gnumeric
sudo apt-get install netbeans
sudo apt-get install gimp
 
Old 02-26-2013, 09:41 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,520

Rep: Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944
Quote:
Originally Posted by jtso8 View Post
sudo add-apt-repository ppa:rockclimb/netbeans
sudo add-apt-repository ppa:stebbins/handbrake-snapshots
sudo add-apt-repository ppa:wfg/0ad
sudo add-apt-repository ppa:mozillateam/ppa
sudo add-apt-repository ppa:libreoffice/ppa
sudo add-apt-repository ppapenjdk/ppa
sudo apt-add-repository ppa:aims/sagemath
sudo add-apt-repository ppa:kubuntu-ppa/beta
sudo add-apt-repository ppa:n-muench/vl
sudo apt-get update
sudo apt-get install sagemath-upstream-binary
sudo apt-get install 0ad
sudo apt-get install handbrake-gtk
sudo apt-get install cantor
sudo apt-get install ubuntu-restricted-extras
sudo apt-get install vlc vlc-plugin-pulse mozilla-plugin-vlc
sudo apt-get install gnumeric
sudo apt-get install netbeans
sudo apt-get install gimp
Ok...so you've got a list of apt-get commands. Put them in a file, with "#!/bin/bash" at the top. Enjoy your script.

If you want it to not prompt for a password, just modify the sudoers file to let your account use the apt-get command without requiring a password.
 
Old 02-26-2013, 10:45 AM   #5
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,449

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
Hi

The sudo's will only ask for password once. Pass -y to all the apt-get and add-apt-repository so you don't need to answer yes to all those "do you really want to..." questions.

Code:
sudo add-apt-repository -y ppa:rockclimb/netbeans
sudo add-apt-repository -y ppa:stebbins/handbrake-snapshots
sudo add-apt-repository -y ppa:wfg/0ad
sudo add-apt-repository -y ppa:mozillateam/ppa
sudo add-apt-repository -y ppa:libreoffice/ppa
sudo add-apt-repository -y ppapenjdk/ppa
sudo apt-add-repository -y ppa:aims/sagemath
sudo add-apt-repository -y ppa:kubuntu-ppa/beta
sudo add-apt-repository -y ppa:n-muench/vl
sudo apt-get -y update
sudo apt-get -y install sagemath-upstream-binary
sudo apt-get -y install 0ad
sudo apt-get -y install handbrake-gtk
sudo apt-get -y install cantor
sudo apt-get -y install ubuntu-restricted-extras
sudo apt-get -y install vlc vlc-plugin-pulse mozilla-plugin-vlc
sudo apt-get -y install gnumeric
sudo apt-get -y install netbeans
sudo apt-get -y install gimp
 
  


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
Scripting assistance needed with date manipulation Cerephim Linux - Server 6 08-20-2010 08:35 AM
Awk scripting assistance needed Zmyrgel Programming 11 06-04-2009 08:58 AM
Automated scripting for FireFox? kinetik Linux - General 3 08-02-2006 03:50 AM
No-nothing Newbie Needs Linux Scripting Assistance Alekscat Programming 6 05-06-2004 11:20 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:06 PM.

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
Open Source Consulting | Domain Registration