1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # $Id$
|
---|
4 |
|
---|
5 | #----------------------------------#
|
---|
6 | add_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 |
|
---|
21 | mk_CUSTOM_TOOLS:
|
---|
22 | @\$(call echo_CHROOT_request)
|
---|
23 | @ sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}
|
---|
24 | @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make CUSTOM_TOOLS")
|
---|
25 | @touch \$@
|
---|
26 |
|
---|
27 | CUSTOM_TOOLS:
|
---|
28 | xEOFx
|
---|
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 |
|
---|
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)
|
---|
51 | EOF
|
---|
52 | ) >> ${MKFILE}.tmp2
|
---|
53 |
|
---|
54 | # Create the build script file
|
---|
55 | ( cat <<- xEOFx
|
---|
56 | #!/bin/bash
|
---|
57 | set -e
|
---|
58 |
|
---|
59 | `cat tmp`
|
---|
60 | exit
|
---|
61 | xEOFx
|
---|
62 | ) > custom-commands/scripts/$THIS_SCRIPT
|
---|
63 |
|
---|
64 | else
|
---|
65 | # Create an entry for package
|
---|
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 unpack2,${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 \$@
|
---|
77 | @touch ${TRACKING_DIR}/${PKG}-${PKG_VERSION}
|
---|
78 | @\$(call housekeeping)
|
---|
79 | EOF
|
---|
80 | ) >> ${MKFILE}.tmp2
|
---|
81 |
|
---|
82 | # Create the build script file
|
---|
83 | ( cat <<- xEOFx
|
---|
84 | #!/bin/bash
|
---|
85 | set -e
|
---|
86 |
|
---|
87 | cd \$PKGDIR
|
---|
88 | `cat tmp`
|
---|
89 | exit
|
---|
90 | xEOFx
|
---|
91 | ) > custom-commands/scripts/$THIS_SCRIPT
|
---|
92 | fi
|
---|
93 |
|
---|
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 | #----------------------------------#
|
---|
110 | add_CustomToolsURLS() { # Add any users supplied scripts URL information
|
---|
111 | #----------------------------------#
|
---|
112 | local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
|
---|
113 | local this_script
|
---|
114 | local URL PKG PKG_VERSION PKG_FILE MD5
|
---|
115 |
|
---|
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
|
---|
123 | # A cmd only script had no PKG defined
|
---|
124 | [[ "x${PKG}" = "x" ]] && continue
|
---|
125 |
|
---|
126 | echo "${URL} ${BLFS_SERVER}${PKG}/${PKG_FILE} ${MD5}" >> urls.lst.tmp
|
---|
127 | # Add any patches..
|
---|
128 | for PATCH in PATCH{1..10}; do
|
---|
129 | [[ -n ${!PATCH} ]] && echo "dummy-url ${!PATCH}" >> urls.lst.tmp
|
---|
130 | done
|
---|
131 | done
|
---|
132 | cat urls.lst.tmp >> $BUILDDIR/sources/urls.lst
|
---|
133 | rm urls.lst.tmp
|
---|
134 | }
|
---|