LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Slackpkg question.... (http://www.linuxquestions.org/questions/slackware-14/slackpkg-question-825436/)

linus72 08-10-2010 05:08 PM

Slackpkg question....
 
So, I need to know if there is a way to command slackpkg to reinstall
all installed packages...?

I dont think there is but also wanted to know if I could somehow
edit scripts, etc to enable this

I made a template doing

Code:

slackpkg generate-template Mini
I then tried to run it and of course it says

Quote:

All packages from Mini template are already installed
I need this because as many know here I make variations of livecd's
and I have injured one of my installs when I ran a script that I shouldn't have and it deleted several directories under /etc
usr/lib and /usr/bin
I have no idea exactly what was deleted and thus I wish to reinstall all
installed packages
There must be a way to do this without the borish method of manually reinstalling hundreds of pkgs

Is there a way to grep /var/log/packages and say reinstall all?
thx

MS3FGX 08-10-2010 05:45 PM

If you are trying to reinstall all the packages...why not just reinstall Slackware? You can backup /home so your user configuration is saved (better yet, perhaps you already put /home on it's own partition).

Richard Cranium 08-10-2010 05:58 PM

Quote:

Originally Posted by linus72 (Post 4062385)
So, I need to know if there is a way to command slackpkg to reinstall
all installed packages...?

I dont think there is but also wanted to know if I could somehow
edit scripts, etc to enable this

I made a template doing

Code:

slackpkg generate-template Mini
I then tried to run it and of course it says



I need this because as many know here I make variations of livecd's
and I have injured one of my installs when I ran a script that I shouldn't have and it deleted several directories under /etc
usr/lib and /usr/bin
I have no idea exactly what was deleted and thus I wish to reinstall all
installed packages
There must be a way to do this without the borish method of manually reinstalling hundreds of pkgs

Is there a way to grep /var/log/packages and say reinstall all?
thx

How about...
Code:

echo "a ap d e f k kde l n t tcl x xap y" > /tmp/stuff
slackpkg reinstall /tmp/stuff


dugan 08-10-2010 06:07 PM

Save a line.

Code:

echo "a ap d e f k kde l n t tcl x xap y" | xargs -i slackpkg reinstall {}
EDIT: PLEASE keep in mind that I haven't tried this.

Richard Cranium 08-10-2010 06:17 PM

dugan, I think that your method will run slackpkg 14 times; using the actual file will only run it once.

That's a really neat trick though. I'll keep it in mind for other uses.

linus72 08-10-2010 07:08 PM

I may try that dugan as many of my installs are functioning retarded anyway...

I think it may work as looking at term after running it
Code:

echo "a ap d e f k kde l n t tcl x xap y" | xargs -i slackpkg reinstall {}
seems it correctly will reinstall all..except I unmarked slackpkg of course

here we go....

linus72 08-10-2010 07:29 PM

OK
I ran that above and although it went thru the motions of reinstalling everything there are no .new files anywhere?
and var/cache/packages is empty of pkgs; shouldn't it be full?

EDIT:
update; it didn't actually reinstall anything and although the term showed slackpkg downloading and reinstalling everythin it didnt do anything...lol
how do I make it work for real?
or why is it not working?

piratesmack 08-10-2010 07:40 PM

Quote:

Originally Posted by linus72 (Post 4062460)
OK
there are no .new files anywhere?

If the *.new file is the same as the old one, Slackware deletes it.
Here's the code in the doinst.sh script:
Code:

config() {
  NEW="$1"
  OLD="$(dirname $NEW)/$(basename $NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
    # toss the redundant copy
    rm $NEW
  fi

  # Otherwise, we leave the .new copy for the admin to consider...
}

Quote:

Originally Posted by linus72 (Post 4062460)
and var/cache/packages is empty of pkgs; shouldn't it be full?


No, by default Slackpkg automatically deletes the downloaded packages after it's done with them. You can change that by setting 'DELALL=off' in /etc/slackpkg/slackpkg.conf

linus72 08-10-2010 08:01 PM

OK
then I guess it did work as some things like pkgtool which weren't working seem to be working...
this should be added to slackpkg somehow...so SOLVED I would say!
Thanks everyone/Richard/Dugan!
you guys are sub-genius!

yeah I got new mail /var/mail/root

dive 08-10-2010 10:39 PM

I haven't tried this but why not do

Code:

slackpkg reinstall a ap d e f k kde l n t tcl x xap y
Instead of messing about with files and xargs? Does it work?

piratesmack 08-11-2010 02:32 AM

Quote:

Originally Posted by dive (Post 4062543)
I haven't tried this but why not do

Code:

slackpkg reinstall a ap d e f k kde l n t tcl x xap y
Instead of messing about with files and xargs? Does it work?

Yeah, no need to use xargs here.

xargs would be useful for something like:
Code:

# find all packages that end with a build number (unofficial packages
# usually end with a tag) EXCEPT for aaa_elflibs and pass them as args
# to 'slackpkg reinstall'
ls /var/log/packages/ \
  | grep '[1-9][0-9]*$' \
  | grep -v '^aaa_elflibs' \
  | rev \
  | cut -d- -f4- \
  | rev \
  | xargs slackpkg reinstall

Note: Just an example, don't really use this. The other command is better I think.

Richard Cranium 08-11-2010 07:13 AM

Quote:

Originally Posted by dive (Post 4062543)
I haven't tried this but why not do

Code:

slackpkg reinstall a ap d e f k kde l n t tcl x xap y
Instead of messing about with files and xargs? Does it work?

The slackpkg man page was rather vague in its explanation of PATTERN on the command line. The man page stated rather plainly that a file containing many patterns would work. I pointed the OP to a solution that I was very confident would work versus one for which I wasn't. That's all.


All times are GMT -5. The time now is 03:49 PM.