source: common/custom_pkgs@ a2133cb

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since a2133cb was e7655b2, checked in by George Boudreau <georgeb@…>, 18 years ago

Added the ability to create custom scripts that do not reference tarballs.. self contained bash scripts

  • Property mode set to 100644
File size: 3.3 KB
RevLine 
[9a536f7]1#!/bin/sh
2
[93d32cf]3# $Id$
4
[9a536f7]5#----------------------------------#
6add_CustomTools() { # Add any users supplied scripts
7#----------------------------------#
8 PREV_SCRIPT=""
9 CUSTOM_LIST=""
10
11 echo "Adding custom packages... ${BOLD}START${OFF}"
12
13 cd $JHALFSDIR
14 > ${MKFILE}.tmp2
15
16 # First some build commands and a placeholder for the build list.
17 # This will not cause problems if there are no custom scripts.
18( cat << xEOFx
19
20
21mk_CUSTOM_TOOLS:
22 @\$(call echo_CHROOT_request)
[53f291f]23 @ sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}
[9a536f7]24 @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make CUSTOM_TOOLS")
25 @touch \$@
26
27CUSTOM_TOOLS:
28xEOFx
29) >> ${MKFILE}.tmp2
30
31
32 for this_script in custom-commands/config/*; do
33 if [[ `basename ${this_script}` = "*" ]]; then
34 break
35 fi
36 source $this_script
37 THIS_SCRIPT=$(basename ${this_script})
38 echo "$tab_${GREEN}Adding${OFF} ${THIS_SCRIPT}"
39
[e7655b2]40 # Create a Makefile entry
41 if [[ "x${PKG}" = "x" ]]; then
42 # Create an entry for a self contained cmd script that does not reference a package tarball
43( cat << EOF
44
45${THIS_SCRIPT}: ${PREV_SCRIPT}
46 @\$(call echo_message, Building)
47 @./progress_bar.sh \$@ \$\$PPID &
48 @( time { source envars && /\$(SCRIPT_ROOT)/custom-commands/scripts/${THIS_SCRIPT} >>logs/${THIS_SCRIPT} 2>&1 ; } ) 2>>logs/${THIS_SCRIPT}
49 @touch \$@
50 @\$(call housekeeping)
51EOF
52) >> ${MKFILE}.tmp2
53
54 # Create the build script file
55( cat <<- xEOFx
56#!/bin/bash
57set -e
58
59`cat tmp`
60exit
61xEOFx
62) > custom-commands/scripts/$THIS_SCRIPT
63
64 else
65 # Create an entry for package
[9a536f7]66( cat << EOF
67
68${THIS_SCRIPT}: ${PREV_SCRIPT}
69 @\$(call echo_message, Building)
70 @./progress_bar.sh \$@ \$\$PPID &
71 @\$(call remove_existing_dirs2,${PKG_FILE})
72 @\$(call unpack3,${PKG_FILE})
73 @\$(call get_pkg_root2)
74 @( time { source envars && /\$(SCRIPT_ROOT)/custom-commands/scripts/${THIS_SCRIPT} >>logs/${THIS_SCRIPT} 2>&1 ; } ) 2>>logs/${THIS_SCRIPT}
75 @\$(call remove_build_dirs2,${PKG})
76 @touch \$@
[53f291f]77 @touch ${TRACKING_DIR}/${PKG}-${PKG_VERSION}
[9a536f7]78 @\$(call housekeeping)
79EOF
80) >> ${MKFILE}.tmp2
81
82 # Create the build script file
83( cat <<- xEOFx
[245d1c9]84#!/bin/bash
[9a536f7]85set -e
[245d1c9]86
[9a536f7]87cd \$PKGDIR
88`cat tmp`
89exit
90xEOFx
91) > custom-commands/scripts/$THIS_SCRIPT
[e7655b2]92 fi
93
[9a536f7]94 chmod 755 custom-commands/scripts/$THIS_SCRIPT
95 rm -f tmp
96 PREV_SCRIPT=$THIS_SCRIPT
97 CUSTOM_LIST="${CUSTOM_LIST}${THIS_SCRIPT} "
98 done
99
100 # Add the dependancy list.
101 sed "s|^CUSTOM_TOOLS:|CUSTOM_TOOLS: ${CUSTOM_LIST}|" -i ${MKFILE}.tmp2
102 cat ${MKFILE}.tmp2 >> ${MKFILE}
103 rm ${MKFILE}.tmp2
104 echo "Adding custom packages... ${BOLD}DONE${OFF}"
105}
106
107
108
109#----------------------------------#
110add_CustomToolsURLS() { # Add any users supplied scripts URL information
111#----------------------------------#
112 local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
113 local this_script
[245d1c9]114 local URL PKG PKG_VERSION PKG_FILE MD5
115
[9a536f7]116 > urls.lst.tmp
117 for this_script in $JHALFSDIR/custom-commands/config/*; do
118 if [[ `basename ${this_script}` = "*" ]]; then
119 CUSTOM_TOOLS="n"
120 break
121 fi
122 source $this_script
[e7655b2]123 # A cmd only script had no PKG defined
124 [[ "x${PKG}" = "x" ]] && continue
125
[9a536f7]126 echo "${URL} ${BLFS_SERVER}${PKG}/${PKG_FILE} ${MD5}" >> urls.lst.tmp
[245d1c9]127 # Add any patches..
[9a536f7]128 for PATCH in PATCH{1..10}; do
[245d1c9]129 [[ -n ${!PATCH} ]] && echo "dummy-url ${!PATCH}" >> urls.lst.tmp
[9a536f7]130 done
131 done
132 cat urls.lst.tmp >> $BUILDDIR/sources/urls.lst
133 rm urls.lst.tmp
134}
Note: See TracBrowser for help on using the repository browser.