4 Comments

Package World for Reinstall

In you would like to rid the cruft on your system, or if you system has a virus (unlikely) or even if you want to install the system again at a later day a good way to do this is to package all your installed emerges. This can be done with a slightly-modified version of holla’s bash script:

#!/bin/bash
# pkg-world

emerge -peq world | sed -n ‘s|^\[ebuild[^]]*\] \([^ $]\+\).*$|\1|p’ | \
sed -r ‘s/-[^-]+(-r[0-9]+)*$//’ | sort -u | while read pkg; do
for p in “${pkg}”; do
quickpkg –include-config=y –include-unmodified-config=y “$p”;
done;
done

Once this is done you can backup your Gentoo system by:

tar –exclude=gentoo-backup.tgz -cvpzf gentoo-backup.tgz /etc /usr/portage /var/lib/portage/world

Obviously you might want to do more like /home and /root. Then you can extract the tar on a new stage3 and emerge -K --deep world. I’d recommend not trying this if too much time has passed between backup and reinstall as portage configurations may have changed, but otherwise it can save you alot of compiling time.

Please read the comments for other (easier) ways to do this.

About these ads

About Gen2ly

<3's linux

4 comments on “Package World for Reinstall

  1. the following should do the same as above script:

    qlist -CISL | xargs quickpkg stuff

  2. Ah, good thinking. That’s what I love about linux, people eventually find an easier way to do things.

  3. quickpkg –include-config=y –include-unmodified-config=y $(eix -I –only-names)
    Package names don’t contain whitespaces per ebuild naming standard.
    Also, if you want to be on the safe side while not having to wait hours until your command completes you can just enable FEATURE=”buildpkg” and portage will do it for you when updating, push that to a backup server and next time your machine dies, restore will be über fast :)

  4. Didn’t know about that buildpkg feature, pretty cool. Also told viewers to read the comments as these are clearly a better way to do this. Thanks for the tip.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 52 other followers

%d bloggers like this: