-
-# Create a symbolic link to a package that is located in another stage
-# repository (to not have the same file twice).
-# Arg. #1: Source stage number (1, 2, 3, etc)
-# Arg. #2: Package name
-lpkg()
-{
- SRCSTAGE="stage${1}"
- FILE="${2}.tar.bz2"
- PACKAGE_NAME="${2}"
-
- # Checking for correct number of arguments
- if [ $# -ne 2 ]; then
- echo "${FUNCNAME}(), wrong number of arguments: ${*}"
- return 1
- fi
-
- if [ ! -h ${LFS_PKG_DIR}/${FILE} ]; then
- # Issue a warning if source file doesn't exist.
- if [ ! -f ${LFS_PKG_BASE}/${SRCSTAGE}/${FILE} ]; then
- source_link_status=" (missing source file)"
- else
- source_link_status=""
- fi
-
- # Create link if it doesn't exist
- rcmd "Linking ${PACKAGE_NAME}${source_link_status}" ln -s ../${SRCSTAGE}/${FILE} ${LFS_PKG_DIR}/${FILE}
- fi
-
- # Create link for patches corresponding to that package:
- if ls ${LFS_PKG_BASE}/${SRCSTAGE}/${PACKAGE_NAME}-*.patch 1> /dev/null 2>&1; then
- for patch in ${LFS_PKG_BASE}/${SRCSTAGE}/${PACKAGE_NAME}-*.patch; do
- PATCHFILE=$(basename ${patch})
- if [ ! -h ${LFS_PKG_DIR}/${PATCHFILE} ]; then
- # Create link if it doesn't exist
- rcmd "Linking ${PATCHFILE}" ln -s ../${SRCSTAGE}/${PATCHFILE} ${LFS_PKG_DIR}/${PATCHFILE}
- fi
- done
- fi
-}