#!/bin/bash # Written by Alec Warner 1/04/06 # Small script to symlink files from a portage tree to an overlay dir. # This should be run from the overlay, for example '/usr/local/portage/sys-test/testpkg/' if [[ ! -w `pwd` ]] ; then echo "You must be able to write in the current directory!" exit fi CAT=$(dirname $(pwd) ) CAT=${CAT##*/} PACKAGE=$(basename $(pwd) ) PORTDIR="$(portageq envvar PORTDIR)" if [[ ! -d "${PORTDIR}" ]] ; then echo "PORTDIR is Invalid" exit fi LOCATION=${PORTDIR}/${CAT}/${PACKAGE} if [[ -d "${LOCATION}" && -r "${LOCATION}" && -d "${LOCATION}/files" ]] ; then DEST="files" RUN="ln -s "${LOCATION}/${DEST}" ${DEST}" if ! `RUN` ; then ehco "Failed to symlink ${LOCATION}/${DEST} to ${DEST}" exit fi else echo "Found Category ${CAT} and Package ${PACKAGE} but could not find a files directory with Portdir ${PORTDIR}" exit fi