frankenputer n00b
Joined: 09 Mar 2016 Posts: 26
|
Posted: Fri Jul 08, 2016 2:56 pm Post subject: [HOWTO] Start using per package USE flags |
|
|
As listed in the wiki, a Gentoo newcomer might find himself in a struggle to get all of the system packages USE flags. The upstream versions in future might add/drop some USE flags, so this functions takes care of updating the USE flags for you.
Code: | useflagspacks() {
the_temp=$(mktemp --tmpdir XXXXXX)
the_packs='/tmp/allpacks'
qlist --installed --umap --nocolor --verbose > "${the_temp}"
declare -a remove_flags=(
'(' ')'
# some `sed' regex kung fu
'\S*\('{abi_,elibc_,kernel_,video_}'\)\S*'
'\S*\('{input_,linguas_,userland_}'\)\S*'
'\S*\(cpu_flags\|python_\)\S*'
)
for x in "${remove_flags[@]}"
do
sed -i "s/${x}//g" "${the_temp}"
done
# make sure the rest USE flags are not empty
gawk '{
for (x=2; x <= NF; x++) {
if ("" != $x) {
print ">="$0;
break;
}
}
}' "${the_temp}" > "${the_packs}"
[[ -f "${the_temp}" ]] && rm "${the_temp}"
} |
Trimmed output from /tmp/allpacks:
Code: | >=x11-misc/dmenu-4.6 xinerama
>=x11-misc/dzen-0.9.5-r1 xft xinerama |
Backup all of the installed packages (qlist --installed > file), make.conf and this file, so you can restore your system and installed packages with the USE flags as if nothing happened. |
|