source: common/custom_pkgs@ 6dc325f

experimental
Last change on this file since 6dc325f was 42e1b38, checked in by George Boudreau <georgeb@…>, 18 years ago

Add code for user defined scripts. User scripts added at the end of the final build (LFS only)

  • Property mode set to 100644
File size: 2.6 KB
Line 
1#!/bin/sh
2
3#----------------------------------#
4add_CustomTools() { # Add any users supplied scripts
5#----------------------------------#
6 PREV_SCRIPT=""
7 CUSTOM_LIST=""
8
9 echo "Adding custom packages... ${BOLD}START${OFF}"
10
11 cd $JHALFSDIR
12 > ${MKFILE}.tmp2
13
14 # First some build commands and a placeholder for the build list.
15 # This will not cause problems if there are no custom scripts.
16( cat << xEOFx
17
18
19mk_CUSTOM_TOOLS:
20 @\$(call echo_CHROOT_request)
21 @ sudo mkdir -p /home/georgeb/TRIAL/var/lib/jhalfs/BLFS
22 @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make CUSTOM_TOOLS")
23 @touch \$@
24
25CUSTOM_TOOLS:
26xEOFx
27) >> ${MKFILE}.tmp2
28
29
30 for this_script in custom-commands/config/*; do
31 if [[ `basename ${this_script}` = "*" ]]; then
32 break
33 fi
34 source $this_script
35 THIS_SCRIPT=$(basename ${this_script})
36 echo "$tab_${GREEN}Adding${OFF} ${THIS_SCRIPT}"
37
38( cat << EOF
39
40${THIS_SCRIPT}: ${PREV_SCRIPT}
41 @\$(call echo_message, Building)
42 @./progress_bar.sh \$@ \$\$PPID &
43 @\$(call remove_existing_dirs2,${PKG_FILE})
44 @\$(call unpack3,${PKG_FILE})
45 @\$(call get_pkg_root2)
46 @( time { source envars && /\$(SCRIPT_ROOT)/custom-commands/scripts/${THIS_SCRIPT} >>logs/${THIS_SCRIPT} 2>&1 ; } ) 2>>logs/${THIS_SCRIPT}
47 @\$(call remove_build_dirs2,${PKG})
48 @touch \$@
49 @touch /var/lib/jhalfs/BLFS/${PKG}-${PKG_VERSION}
50 @\$(call housekeeping)
51EOF
52) >> ${MKFILE}.tmp2
53
54 # Create the build script file
55( cat <<- xEOFx
56set -e
57cd \$PKGDIR
58`cat tmp`
59exit
60xEOFx
61) > custom-commands/scripts/$THIS_SCRIPT
62 chmod 755 custom-commands/scripts/$THIS_SCRIPT
63 rm -f tmp
64
65 PREV_SCRIPT=$THIS_SCRIPT
66 CUSTOM_LIST="${CUSTOM_LIST}${THIS_SCRIPT} "
67 done
68
69 # Add the dependancy list.
70 sed "s|^CUSTOM_TOOLS:|CUSTOM_TOOLS: ${CUSTOM_LIST}|" -i ${MKFILE}.tmp2
71 cat ${MKFILE}.tmp2 >> ${MKFILE}
72 rm ${MKFILE}.tmp2
73 echo "Adding custom packages... ${BOLD}DONE${OFF}"
74}
75
76
77
78#----------------------------------#
79add_CustomToolsURLS() { # Add any users supplied scripts URL information
80#----------------------------------#
81 local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
82 local this_script
83 local URL PKG PKG_VERSION PKG_FILE MD5
84
85 > urls.lst.tmp
86 for this_script in $JHALFSDIR/custom-commands/config/*; do
87 if [[ `basename ${this_script}` = "*" ]]; then
88 CUSTOM_TOOLS="n"
89 break
90 fi
91 source $this_script
92 echo "${URL} ${BLFS_SERVER}${PKG}/${PKG_FILE} ${MD5}" >> urls.lst.tmp
93 # Add any patches..
94 for PATCH in PATCH{1..10}; do
95 [[ -n ${!PATCH} ]] && echo "dummy-url ${!PATCH}" >> urls.lst.tmp
96 done
97 done
98 cat urls.lst.tmp >> $BUILDDIR/sources/urls.lst
99 rm urls.lst.tmp
100}
Note: See TracBrowser for help on using the repository browser.