2013年1月24日 星期四

Gentoo Linux: What to do if you deleted package.use file accidentally?

In Gentoo Linux, package information is stored in /var/db/pkg

And the installed USE flags is stored in `USE` file, for example: /var/db/pkg/dev-lang/php-***/USE.

To restore these USE flags back to your /etc/portage/package.use file, simply type the command below:

cd /var/db/pkg/ && ls -d */* | while read pkg ; do echo -n "$pkg " ; cat $pkg/USE ; done >> /etc/portage/package.use