summaryrefslogblamecommitdiffstats
path: root/postsync.d/regen-overlays
blob: bbaec320fdae979b355673befadf9d1d68442295 (plain) (tree)
1
2
3
4
5
6
7
8
9
           


                          

                                                             
                                        

                                          

                                                       



                                                     
                                                                            









                                                                                
                                                                   







                                                                                           
                                                                                      
  

      
#!/bin/bash

. /etc/init.d/functions.sh

OVERLAY_CONFIG_DIR="$(update-eix --print EIXCFGDIR)/overlays"

ebegin "Regenerating overlay config ..."

if [ ! -d "${OVERLAY_CONFIG_DIR}" ] ; then
	eerror "${OVERLAY_CONFIG_DIR} does not exists!"
	eend 1
	return 1 
fi

if [ ! -f "${OVERLAY_CONFIG_DIR}/make.conf" ] ;  then
	ewarn "${OVERLAY_CONFIG_DIR}/make.conf does not exists, creating..."
	touch "${OVERLAY_CONFIG_DIR}/make.conf"
fi 

echo "PORTDIR_OVERLAY=\"\${PORTDIR_OVERLAY}" > "${OVERLAY_CONFIG_DIR}/make.conf"

for overlay_config in $(ls ${OVERLAY_CONFIG_DIR}); do
    unset LOCATION

	if [[ "${overlay_config}" != "make.conf" ]] ; then
	    source ${OVERLAY_CONFIG_DIR}/${overlay_config}
   		if [[ -n "${LOCATION}" && -d "${LOCATION}" ]]; then
       		echo "	${LOCATION}" >> "${OVERLAY_CONFIG_DIR}/make.conf"
		fi
	fi
done

echo "\"" >> "${OVERLAY_CONFIG_DIR}/make.conf"

if [[ -z "$(grep "^[ \t]*source ${OVERLAY_CONFIG_DIR}/make.conf" /etc/make.conf)" ]] ; then
	ewarn "\"source ${OVERLAY_CONFIG_DIR}/make.conf\" not found in /etc/make.conf"
fi

eend 0