#!/bin/bash fix-missing-slashes() { for f in "$@" ; do if [[ -f "$f" ]] ; then grep -q '${PWD}${ROOT}' "${f}" || { echo -n "${f}[OK] " ; continue ; } sed -e 's|\${PWD}\${ROOT}|${PWD}/${ROOT}|g' "${f}" -i echo -n "${f}[FIXED] " d=${f%/files/*} [[ ${dirfix} == *${d}* ]] || dirfix="${dirfix} ${d}" else echo -n "${f}[ERR] " fi done } trees="$@" [[ -z $trees ]] && trees="$(portageq envvar PORTDIR) $(portageq envvar PORTDIR_OVERLAY)" dirfix= for tree in ${trees} ; do if [[ ! -d "${tree}" ]] ; then echo "Warning: \"${tree}\" skippied because not a dirctory." continue fi echo -n "Fixing in ${tree}: " fix-missing-slashes "${tree}"/sys-devel/*-config/files/*-config-* echo echo done for d in ${dirfix} ; do for e in ${d}/*.ebuild ; do echo -n "${e}: " ebuild "${e}" digest done ; done echo echo "done!"