Ignore:
Timestamp:
09/29/2007 06:57:23 PM (17 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
experimental
Children:
e2dfa2c
Parents:
e5fe832
Message:

Updated CUSTOM_TOOLS code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/libs/func_custom_pkgs

    re5fe832 rdfa51ee  
    88  PREV=""
    99
    10   echo "  Adding custom packages... ${BOLD}START${OFF}"
     10  echo "${tab_}${GREEN}Processing... ${L_arrow}CUSTOM_TOOLS ${R_arrow}"
    1111
    12   # Create the custom_tools scripts directory
    13   mkdir -p custom-tools
     12  for file in custom-tools/* ; do
     13    # Keep the script file name
     14    this_script=`basename $file`
    1415
    15   for file in $JHALFSDIR/custom-commands/*; do
    16     if [[ `basename ${file}` = "*" ]]; then
    17       break
    18     fi
    19     source $file
    20     this_script=$(basename ${file})
    21     echo "$tab_${GREEN}Adding${OFF} ${this_script}"
     16    # Grab the phase name to be used with INSTALL_LOG and tracking dir touch
     17    name=`grep "^PKG_PHASE=" ${file} | sed -e 's@PKG_PHASE=@@'`
     18    # Grab also the package version
     19    pkg_ver=`grep "^VERSION=" ${file} | sed -e 's@VERSION=@@'`
    2220
    23       # Create a Makefile entry
    24     if [[ "x${PKG}" = "x" ]]; then
    25     # Create an entry for a self contained cmd script that does not
    26     # reference a package tarball
    27       case $PROGNAME in
    28         clfs2 | clfs3 )
    29           LUSER_wrt_target "${this_script}" "$PREV"
    30           LUSER_wrt_RunAsUser "custom-tools/${this_script}"
    31           ;;
    32         *)
    33           CHROOT_wrt_target "${this_script}" "$PREV"
    34           CHROOT_wrt_RunAsRoot "custom-tools/${this_script}"
    35           ;;
    36       esac
    37       wrt_touch
     21    # Append each name of the script files to a list (this will become
     22    # the names of the targets in the Makefile)
     23    custom_list="$custom_list ${this_script}"
    3824
    39     # Create the build script file
    40 ( cat <<- xEOFx
    41 #!/bin/bash
    42 set -e
     25    #--------------------------------------------------------------------#
     26    #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     27    #--------------------------------------------------------------------#
     28    #
     29    # Drop in the name of the target on a new line, and the previous target
     30    # as a dependency. Also call the echo_message function.
     31    wrt_target "${this_script}" "$PREV"
    4332
    44 `cat tmp`
    45 exit
    46 xEOFx
    47 ) > custom-tools/${this_script}
    48 
    49     else
    50     # Create an entry for package
    51       case $PROGNAME in
    52         clfs2 | clfs3 )
    53           LUSER_wrt_target "${this_script}" "$PREV"
    54           LUSER_wrt_unpack "${PKG_FILE}"
    55           LUSER_wrt_RunAsUser "custom-tools/${this_script}"
    56           LUSER_RemoveBuildDirs "${PKG}"
    57           echo -e "\t@touch \$(MOUNT_PT)$TRACKING_DIR/${PKG}-${PKG_VERSION}" >>  $MKFILE.tmp
    58           ;;
    59         *)
    60           CHROOT_wrt_target "${this_script}" "$PREV"
    61           CHROOT_Unpack "${PKG_FILE}"
    62           CHROOT_wrt_RunAsRoot "custom-tools/${this_script}"
    63           CHROOT_wrt_RemoveBuildDirs "${PKG}"
    64           echo -e "\t@touch $TRACKING_DIR/${PKG}-${PKG_VERSION}" >>  $MKFILE.tmp
    65           ;;
    66       esac
    67       wrt_touch
    68 
    69     # Create the build script file
    70 ( cat <<- xEOFx
    71 #!/bin/bash
    72 set -e
    73 
    74 cd \$PKGDIR
    75 `cat tmp`
    76 exit
    77 xEOFx
    78 ) > custom-tools/$this_script
     33    # Touch timestamp file if installed files logs will be created.
     34    if [ "$name" != "" ] && [ "${INSTALL_LOG}" = "y" ] ; then
     35      wrt_TouchTimestamp
    7936    fi
    8037
    81     rm -f tmp
    82     PREV=$this_script
    83     custom_list="${custom_list} ${this_script}"
     38    # Run the script.
     39    wrt_RunScript "$file"
     40
     41    # Write installed files log
     42    if [ "$name" != "" ] && [ "${INSTALL_LOG}" = "y" ] ; then
     43      wrt_LogNewFiles "$name"
     44    fi
     45
     46    # Touch the tracking file.
     47    if [ "$PROGNAME" = "clfs2" ]; then
     48      echo -e "\t@touch \$(MOUNT_PT)$TRACKING_DIR/${name}-${pkg_ver}" >>  $MKFILE.tmp
     49    else
     50      echo -e "\t@touch $TRACKING_DIR/${name}-${pkg_ver}" >>  $MKFILE.tmp
     51    fi
     52
     53    # Include a touch of the target name so make can check
     54    # if it's already been made.
     55    wrt_touch
     56    #
     57    #--------------------------------------------------------------------#
     58    #              >>>>>>>> END OF Makefile ENTRY <<<<<<<<               #
     59    #--------------------------------------------------------------------#
     60
     61    # Keep the script file name for Makefile dependencies.
     62    PREV=${this_script}
    8463  done
    85 
    86   # Make the scripts executable.
    87   chmod +x custom-tools/*
    88 
    89   echo "  Adding custom packages... ${BOLD}DONE${OFF}"
    9064}
    91 
    92 
    93 #----------------------------------#
    94 add_CustomToolsURLS() {            # Add any users supplied scripts URL information
    95 #----------------------------------#
    96   local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
    97   local this_script
    98   local URL PKG PKG_VERSION PKG_FILE MD5
    99 
    100   > urls.lst.tmp
    101   for this_script in $JHALFSDIR/custom-commands/*; do
    102     if [[ `basename ${this_script}` = "*" ]]; then
    103       CUSTOM_TOOLS="n"
    104       break
    105     fi
    106     source $this_script
    107       # A cmd only script had no PKG defined
    108     [[ "x${PKG}" = "x" ]] && continue
    109 
    110     echo "${URL} ${BLFS_SERVER}${PKG}/${PKG_FILE} ${MD5}" >> urls.lst.tmp
    111      # Add any patches..
    112     for PATCH in PATCH{1..10}; do
    113       [[ -n ${!PATCH} ]] && echo "dummy-url ${!PATCH}" >> urls.lst.tmp
    114     done
    115   done
    116   cat  urls.lst.tmp >> $BUILDDIR/sources/urls.lst
    117   rm urls.lst.tmp
    118 }
Note: See TracChangeset for help on using the changeset viewer.