LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 02-28-2010, 09:26 AM   #31
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33

The string 'linux-pam' (not case sensitive) is not in the file.
 
Old 02-28-2010, 09:35 AM   #32
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Ok,

For obvious reasons let's make a copy of what's installed first. Run the following command:
Code:
sudo dpkg --get-selections >OriginalSelected.txt
That will save the list of your packages selections and their state into a file. Keep that file safe since it's the original standard install if you haven't installed anything yet.

Kind regards,

Eric
 
Old 02-28-2010, 09:38 AM   #33
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
Ok, I did it. They all have the same state (install). Why isn't OriginalSelected.txt equal to original.txt, since they're both supposed to be the list of all the packages currently installed ?
 
Old 02-28-2010, 09:48 AM   #34
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
No, the two are different. The file original.txt is only a listing of the documentation directory, assuming that all the packages you installed had been written properly with documentation. It's not by far a for sure complete list of the packages you might have had installed in your previous system.

The file you just generated is generated by the dpkg program (the Debian package management tool) including the state of the packages. It will also include packages that don't have documentation in /usr/share/doc, that's the big difference.

Kind regards,

Eric
 
Old 02-28-2010, 09:52 AM   #35
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Next, you're going to write a script.

Open a terminal and type
Code:
nano autoinstall.sh
That will open an editor. Type in that editor the following:
Code:
#!/bin/sh

while read line; do apt-get install $line; done<p2install.txt
Then while in the Nano editor type CTRL-O (letter o) and enter to save your file and next CTRL-X to exit the editor.

Now give executing permissions to the file with the following command:
Code:
chmod +x autoinstall.sh
All of this, if done correctly, will give you a script that you will call with sudo and thus open in a subshell so that for the duration of the script (the time it takes to install all the packages from the list), you should not be prompted for your password again. Make sure that the p2install.txt file is in the same directory as your autoinstall.sh script.

Now, to start installing, type the following:
Code:
sudo ./autoinstall.sh
If packages are already installed then nothing will be done for that package and the next one should start automatically.

Post any result/errors here please.

Kind regards,

Eric
 
Old 02-28-2010, 10:01 AM   #36
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
I tried to find out the differences between original and originalselected so I wrote comm -13 original.txt originalselected.txt, but the result showed items that are in both lists. Why is that ?
 
Old 02-28-2010, 10:04 AM   #37
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Can you give an example?
 
Old 02-28-2010, 10:06 AM   #38
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
If you ran that command as you typed it, you'd only see what's in originalselected because of the -13. If you want to see the full output and differences, just run:
Code:
comm original.txt originalselected.txt
and it'll show three columns as explained in previous post.

Kind regards,

Eric
 
Old 02-28-2010, 10:08 AM   #39
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
Oh I think I understand why. It's due to the fact that every line of originalselected is followed by 'install'. Can I remove that word ?
 
Old 02-28-2010, 10:12 AM   #40
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
NO, don't remove it!!!

Don't touch that originalselected.txt file at all. That's like a database of what you have installed currently and the state of those packages installed. If ever your system might be in trouble or you have to reinstall then you can use that file to automatically reinstall all the packages correctly. So don't touch it. If you want to try stuff or compare to another file then just make a copy like this:
Code:
cp originalselected.txt playfile.txt
and work on the playfile.

Kind regards,

Eric
 
Old 02-28-2010, 10:19 AM   #41
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
Ok. How to remove the word 'installed' from the end of every line of playfile.txt ?
I'm sorry to delay the shell script right now, it's just that I'd really like to understand the differences between the 2 installations, given that, as you know, it wasn't me who made the first installation. Maybe there are packages that I don't need in that list.

You said that "If packages are already installed then nothing will be done for that package and the next one should start automatically." But then this means I won't be able to use this list to undo everything I will have installed, as this list will also uninstall packages that were already installed. Unless there's a way to tell the script to save the packages that were not installed, because they were already there ? Then I could use this new list to remove what I have installed. I hope what I said is understandable.
 
Old 02-28-2010, 10:37 AM   #42
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by elishac View Post
Ok. How to remove the word 'installed' from the end of every line of playfile.txt ?
Code:
sed -i 's/ install//g' playfile.txt
would do the trick.
Quote:
I'm sorry to delay the shell script right now, it's just that I'd really like to understand the differences between the 2 installations, given that, as you know, it wasn't me who made the first installation. Maybe there are packages that I don't need in that list.
Ok, no problem. It's great that you're putting in the time to try and understand, and most importantly, learn from it. That's how we all got started
Quote:
You said that "If packages are already installed then nothing will be done for that package and the next one should start automatically." But then this means I won't be able to use this list to undo everything I will have installed, as this list will also uninstall packages that were already installed. Unless there's a way to tell the script to save the packages that were not installed, because they were already there ? Then I could use this new list to remove what I have installed. I hope what I said is understandable.
When you are processing the list of packages (p2install.txt), apt-get will try to install every package one by one. If a package is already installed, the apt-get will tell you that and the script will move on to the next line.

The list p2install.pkg is only a list of the packages you got as a result from the difference between packages.txt (gotten from listing /usr/share/doc) and what you have currently installed (using the same command on /usr/share/doc).

As stated before, the p2install.pkg is by no means whatsoever a guaranteed complete list of what was installed on your previous system.

The originalselected.txt file on the other hand is generated from the package manager and NOT from a listing of the documentation directory. Hence it's more guaranteed to contain all of the packages installed, those that have documentation in /usr/share/doc and those that don't.

You cannot compare the two and rely on the result since they are different by nature. Every documentation listed is related to a package but every package installed doesn't necessarily have a documentation or have one in the one location you listed. It's like comparing two different types of apples, both are apples but they might differ in taste, shape, color, and so on. If you want to do a comparison at this level you'll have to make sure that you are comparing the result from an identical source, which in this case it is not.

I hope that makes it a bit clearer?

Kind regards,

Eric

Last edited by EricTRA; 02-28-2010 at 10:39 AM.
 
Old 02-28-2010, 10:51 AM   #43
elishac
Member
 
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33
It still says that playfile is not in sorted order. I think it's because of the spaces.
Would this remove the spaces ? :
sed -i 's/\t//g' playfile.txt
sed -i 's/ //g' playfile.txt

how to combine these 2 lines, and what does g mean ?
(I'm guessing -i is to use playfile.txt as the ouput ?)

I did this, and it worked, but the comm command still doesn't work. It says playfile is not in sorted order...

Last edited by elishac; 02-28-2010 at 10:56 AM.
 
Old 02-28-2010, 11:11 AM   #44
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Not in sorted order means that it's not sorted. Most likely it's not completely alphabetically sorted. But again, like I mentioned in my earlier post, you cannot compare originalselected.txt to packages.txt or original.txt.

You can combine the sed expressions like this:
Code:
sed -i -e 's/\t//g' -e 's/ //g' playfile.txt
If you want to clean up the playlist file from all spaces and tabs and so, you can use the following:
Code:
cat playlist.txt | awk -F ' ' '{ print $1 }' >newplaylist.txt
That will look at the file like it is in columns using space as a delimiter and only print the first column (the package name) to the file newplaylist.txt. Then you can try to compare that to whatever file you want to compare it to.

Kind regards,

Eric
 
Old 02-28-2010, 11:16 AM   #45
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by elishac View Post
how to combine these 2 lines, and what does g mean ?
(I'm guessing -i is to use playfile.txt as the ouput ?)
The -i means 'in place', that is use the same file for input and output. The g in the expression indicates to perform the requested task globally, that is, on every instance it encounters in the file.

Kind regards,

Eric
 
  


Reply



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
reinstallation changd Linux - Newbie 1 07-07-2006 04:13 PM
Win98 reinstallation michaelc187 General 2 11-05-2004 11:43 AM
Reinstallation! Jmcatch742 Linux - Newbie 3 10-02-2004 06:44 PM
Reinstallation: Doin' it right! mattp Linux - Newbie 40 03-08-2004 10:20 PM
reinstallation Nay Linux - Newbie 10 12-21-2003 08:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:17 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
Open Source Consulting | Domain Registration