=== modified file 'overlay/scripts/update_profiles' --- overlay/scripts/update_profiles 2013-05-16 12:43:04 +0000 +++ overlay/scripts/update_profiles 2013-05-15 17:42:18 +0000 @@ -1,22 +1,31 @@ -#!/bin/bash +#!/bin/zsh package_set=() +package_use=() scan_profile() { local d parent - d="$(realpath "$1")" - [[ -r "$d/parent" ]] && while read parent; do - if [[ "$parent" == /* ]]; then - scan_profile "$ROOT$parent" + d=$1:A + [[ -r $d/parent ]] && while read parent; do + if [[ $parent == /* ]]; then + scan_profile $parent else - scan_profile "$d/$parent" + scan_profile $d/$parent fi - done < "$d/parent" - [[ -r "$d/package.set" ]] && package_set+=( "$d/package.set" ) + done < $d/parent + [[ -r $d/package.set ]] && package_set+=( $d/package.set ) + [[ -r $d/package.use ]] && package_use+=( $d/package.use ) } -scan_profile "$ROOT/etc/portage/make.profile" +if (($#package_set)); then + mkdir /etc/portage/sets + cat $package_set >/etc/portage/sets/profile +fi -if [[ -n "$package_set" ]]; then - [[ -d "$ROOT/etc/portage/sets" ]] || mkdir "$ROOT/etc/portage/sets" - sort -u "$package_set" >"$ROOT/etc/portage/sets/profile" +if (($#package_use)); then + if [[ -f /etc/package.use ]]; then + mv -v /etc/package.use{,.custom.$$} || exit 1 + mkdir -v /etc/package.use || exit 1 + mv -v /etc/package.use{.custom.$$,/custom} + fi + cat $package_use >/etc/portage/sets/profile fi