2006-11-11 12:39:16 +01:00
|
|
|
#!/bin/bash
|
2006-10-14 19:22:29 +02:00
|
|
|
|
2006-10-16 19:26:37 +02:00
|
|
|
# $Id$
|
|
|
|
|
2006-10-14 19:22:29 +02:00
|
|
|
#----------------------------------#
|
|
|
|
add_CustomTools() { # Add any users supplied scripts
|
|
|
|
#----------------------------------#
|
|
|
|
PREV_SCRIPT=""
|
|
|
|
CUSTOM_LIST=""
|
|
|
|
|
|
|
|
echo "Adding custom packages... ${BOLD}START${OFF}"
|
|
|
|
|
|
|
|
cd $JHALFSDIR
|
|
|
|
> ${MKFILE}.tmp2
|
|
|
|
|
|
|
|
# First some build commands and a placeholder for the build list.
|
|
|
|
# This will not cause problems if there are no custom scripts.
|
|
|
|
( cat << xEOFx
|
|
|
|
|
|
|
|
|
|
|
|
mk_CUSTOM_TOOLS:
|
|
|
|
@\$(call echo_CHROOT_request)
|
2006-10-16 20:17:01 +02:00
|
|
|
@ sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}
|
2006-10-14 19:22:29 +02:00
|
|
|
@( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make CUSTOM_TOOLS")
|
|
|
|
@touch \$@
|
|
|
|
|
|
|
|
CUSTOM_TOOLS:
|
|
|
|
xEOFx
|
|
|
|
) >> ${MKFILE}.tmp2
|
|
|
|
|
|
|
|
|
|
|
|
for this_script in custom-commands/config/*; do
|
|
|
|
if [[ `basename ${this_script}` = "*" ]]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
source $this_script
|
|
|
|
THIS_SCRIPT=$(basename ${this_script})
|
|
|
|
echo "$tab_${GREEN}Adding${OFF} ${THIS_SCRIPT}"
|
|
|
|
|
2006-10-17 00:59:45 +02:00
|
|
|
# Create a Makefile entry
|
|
|
|
if [[ "x${PKG}" = "x" ]]; then
|
|
|
|
# Create an entry for a self contained cmd script that does not reference a package tarball
|
|
|
|
( cat << EOF
|
|
|
|
|
|
|
|
${THIS_SCRIPT}: ${PREV_SCRIPT}
|
|
|
|
@\$(call echo_message, Building)
|
|
|
|
@./progress_bar.sh \$@ \$\$PPID &
|
|
|
|
@( time { source envars && /\$(SCRIPT_ROOT)/custom-commands/scripts/${THIS_SCRIPT} >>logs/${THIS_SCRIPT} 2>&1 ; } ) 2>>logs/${THIS_SCRIPT}
|
|
|
|
@touch \$@
|
|
|
|
@\$(call housekeeping)
|
|
|
|
EOF
|
|
|
|
) >> ${MKFILE}.tmp2
|
|
|
|
|
|
|
|
# Create the build script file
|
|
|
|
( cat <<- xEOFx
|
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
`cat tmp`
|
|
|
|
exit
|
|
|
|
xEOFx
|
|
|
|
) > custom-commands/scripts/$THIS_SCRIPT
|
2006-11-11 12:39:16 +01:00
|
|
|
|
2006-10-17 00:59:45 +02:00
|
|
|
else
|
|
|
|
# Create an entry for package
|
2006-10-14 19:22:29 +02:00
|
|
|
( cat << EOF
|
|
|
|
|
|
|
|
${THIS_SCRIPT}: ${PREV_SCRIPT}
|
|
|
|
@\$(call echo_message, Building)
|
|
|
|
@./progress_bar.sh \$@ \$\$PPID &
|
|
|
|
@\$(call remove_existing_dirs2,${PKG_FILE})
|
|
|
|
@\$(call unpack3,${PKG_FILE})
|
|
|
|
@\$(call get_pkg_root2)
|
|
|
|
@( time { source envars && /\$(SCRIPT_ROOT)/custom-commands/scripts/${THIS_SCRIPT} >>logs/${THIS_SCRIPT} 2>&1 ; } ) 2>>logs/${THIS_SCRIPT}
|
|
|
|
@\$(call remove_build_dirs2,${PKG})
|
|
|
|
@touch \$@
|
2006-10-16 20:17:01 +02:00
|
|
|
@touch ${TRACKING_DIR}/${PKG}-${PKG_VERSION}
|
2006-10-14 19:22:29 +02:00
|
|
|
@\$(call housekeeping)
|
|
|
|
EOF
|
|
|
|
) >> ${MKFILE}.tmp2
|
|
|
|
|
|
|
|
# Create the build script file
|
|
|
|
( cat <<- xEOFx
|
2006-10-16 19:22:57 +02:00
|
|
|
#!/bin/bash
|
2006-10-14 19:22:29 +02:00
|
|
|
set -e
|
2006-10-16 19:22:57 +02:00
|
|
|
|
2006-10-14 19:22:29 +02:00
|
|
|
cd \$PKGDIR
|
|
|
|
`cat tmp`
|
|
|
|
exit
|
|
|
|
xEOFx
|
|
|
|
) > custom-commands/scripts/$THIS_SCRIPT
|
2006-10-17 00:59:45 +02:00
|
|
|
fi
|
2006-11-11 12:39:16 +01:00
|
|
|
|
2006-10-14 19:22:29 +02:00
|
|
|
chmod 755 custom-commands/scripts/$THIS_SCRIPT
|
|
|
|
rm -f tmp
|
|
|
|
PREV_SCRIPT=$THIS_SCRIPT
|
|
|
|
CUSTOM_LIST="${CUSTOM_LIST}${THIS_SCRIPT} "
|
|
|
|
done
|
|
|
|
|
|
|
|
# Add the dependancy list.
|
|
|
|
sed "s|^CUSTOM_TOOLS:|CUSTOM_TOOLS: ${CUSTOM_LIST}|" -i ${MKFILE}.tmp2
|
|
|
|
cat ${MKFILE}.tmp2 >> ${MKFILE}
|
|
|
|
rm ${MKFILE}.tmp2
|
|
|
|
echo "Adding custom packages... ${BOLD}DONE${OFF}"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------#
|
|
|
|
add_CustomToolsURLS() { # Add any users supplied scripts URL information
|
|
|
|
#----------------------------------#
|
|
|
|
local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
|
|
|
|
local this_script
|
2006-10-16 19:22:57 +02:00
|
|
|
local URL PKG PKG_VERSION PKG_FILE MD5
|
|
|
|
|
2006-10-14 19:22:29 +02:00
|
|
|
> urls.lst.tmp
|
|
|
|
for this_script in $JHALFSDIR/custom-commands/config/*; do
|
|
|
|
if [[ `basename ${this_script}` = "*" ]]; then
|
|
|
|
CUSTOM_TOOLS="n"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
source $this_script
|
2006-10-17 00:59:45 +02:00
|
|
|
# A cmd only script had no PKG defined
|
|
|
|
[[ "x${PKG}" = "x" ]] && continue
|
2006-11-11 12:39:16 +01:00
|
|
|
|
2006-10-14 19:22:29 +02:00
|
|
|
echo "${URL} ${BLFS_SERVER}${PKG}/${PKG_FILE} ${MD5}" >> urls.lst.tmp
|
2006-10-16 19:22:57 +02:00
|
|
|
# Add any patches..
|
2006-10-14 19:22:29 +02:00
|
|
|
for PATCH in PATCH{1..10}; do
|
2006-10-16 19:22:57 +02:00
|
|
|
[[ -n ${!PATCH} ]] && echo "dummy-url ${!PATCH}" >> urls.lst.tmp
|
2006-10-14 19:22:29 +02:00
|
|
|
done
|
|
|
|
done
|
|
|
|
cat urls.lst.tmp >> $BUILDDIR/sources/urls.lst
|
|
|
|
rm urls.lst.tmp
|
|
|
|
}
|