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


                          
                                              
                                                    
 
                                        

                                          

                                                       



                                                     
                                                                            









                                                                                
                                                                   







                                                                                           
                                                                                      
  

      
#!/bin/bash

. /etc/init.d/functions.sh

OVERLAY_CONFIG_DIR="$(dirname $0)/../overlays"
OVERLAY_CONFIG_DIR="$(realpath $OVERLAY_CONFIG_DIR)"

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