[877cc6a] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # $Id$
|
---|
| 4 |
|
---|
[4da2512] | 5 | set -e
|
---|
[877cc6a] | 6 |
|
---|
| 7 |
|
---|
| 8 | no_empty_builddir() {
|
---|
| 9 | 'clear'
|
---|
| 10 | cat <<- -EOF-
|
---|
| 11 | ${DD_BORDER}
|
---|
| 12 |
|
---|
| 13 | ${tab_}${tab_}${BOLD}${RED}W A R N I N G${OFF}
|
---|
| 14 | Looks like the \$BUILDDIR directory contains subdirectories
|
---|
| 15 | from a previous HLFS build.
|
---|
| 16 |
|
---|
| 17 | Please format the partition mounted on \$BUILDDIR or set
|
---|
[73e5448] | 18 | a different build directory before running jhalfs.
|
---|
[877cc6a] | 19 | ${OFF}
|
---|
| 20 | ${DD_BORDER}
|
---|
| 21 | -EOF-
|
---|
| 22 | exit
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 |
|
---|
[73e5448] | 26 | HEADER="# This file is automatically generated by jhalfs
|
---|
[877cc6a] | 27 | # DO NOT EDIT THIS FILE MANUALLY
|
---|
| 28 | #
|
---|
| 29 | # Generated on `date \"+%F %X %Z\"`"
|
---|
| 30 |
|
---|
| 31 |
|
---|
[045b2dc] | 32 | #------------------------------------------------------#
|
---|
| 33 | # NEW Makefile scripting functions #
|
---|
| 34 | #------------------------------------------------------#
|
---|
[877cc6a] | 35 |
|
---|
[7eb9402] | 36 |
|
---|
[045b2dc] | 37 | unset get_package_tarball_name
|
---|
[7eb9402] | 38 | #----------------------------------#
|
---|
[045b2dc] | 39 | get_package_tarball_name() { #
|
---|
[7eb9402] | 40 | #----------------------------------#
|
---|
[e66ee70] | 41 | local script_name=`echo ${1} | sed -e 's@[0-9]\{1\}-@@'`
|
---|
[dd29d02] | 42 |
|
---|
| 43 | # The use of 'head' is necessary to limit the return value to the FIRST match..
|
---|
| 44 | # hopefully this will not cause problems.
|
---|
| 45 | #
|
---|
| 46 | case $script_name in
|
---|
[64c9caf] | 47 | tcl) echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 )
|
---|
| 48 | ;;
|
---|
| 49 | linux-headers)
|
---|
| 50 | if [ "${PROGNAME}" = "lfs" ]; then
|
---|
[e66ee70] | 51 | # Uses kernel headers directly
|
---|
[64c9caf] | 52 | echo $(grep "^linux-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
|
---|
| 53 | else
|
---|
[e66ee70] | 54 | # CLFS/HLFS use massaged headers package
|
---|
[64c9caf] | 55 | echo $(grep "^linux-headers-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
|
---|
| 56 | fi
|
---|
| 57 | ;;
|
---|
[5468631] | 58 | *) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
|
---|
[64c9caf] | 59 | ;;
|
---|
[dd29d02] | 60 | esac
|
---|
| 61 |
|
---|
| 62 | }
|
---|
[877cc6a] | 63 |
|
---|
[401f81e] | 64 |
|
---|
[045b2dc] | 65 | unset wrt_RunaAsRoot
|
---|
[5842156] | 66 | #----------------------------------#
|
---|
[045b2dc] | 67 | wrt_RunAsRoot() { # Some scripts must be run as root..
|
---|
[5842156] | 68 | #----------------------------------#
|
---|
[8bea2c8] | 69 | local MOUNT_ENV
|
---|
[045b2dc] | 70 | local this_script=$1
|
---|
| 71 | local file=$2
|
---|
| 72 |
|
---|
| 73 | case ${PROGNAME} in
|
---|
| 74 | lfs ) MOUNT_ENV="LFS" ;;
|
---|
| 75 | blfs ) MOUNT_ENV="BLFS" ;;
|
---|
| 76 | clfs ) MOUNT_ENV="CLFS" ;;
|
---|
| 77 | clfs2 ) MOUNT_ENV="CLFS" ;;
|
---|
[2639f65] | 78 | clfs3 ) MOUNT_ENV="CLFS" ;;
|
---|
[045b2dc] | 79 | hlfs ) MOUNT_ENV="HLFS" ;;
|
---|
| 80 | *) echo "undefined progname $PROGNAME"; exit 1 ;;
|
---|
| 81 | esac
|
---|
| 82 |
|
---|
[5842156] | 83 | (
|
---|
[045b2dc] | 84 | cat << EOF
|
---|
| 85 | @( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\
|
---|
[8bea2c8] | 86 | \$(PRT_DU) >>logs/\$@
|
---|
[5842156] | 87 | EOF
|
---|
| 88 | ) >> $MKFILE.tmp
|
---|
| 89 | }
|
---|
| 90 |
|
---|
[045b2dc] | 91 |
|
---|
| 92 | #------------------------------------------------------#
|
---|
| 93 | #------------------------------------------------------#
|
---|
| 94 |
|
---|
[5842156] | 95 | #----------------------------------#
|
---|
[045b2dc] | 96 | ROOT_RunAsRoot() { #
|
---|
[5842156] | 97 | #----------------------------------#
|
---|
[045b2dc] | 98 | local file=$1
|
---|
[5842156] | 99 | (
|
---|
[045b2dc] | 100 | cat << EOF
|
---|
[8bea2c8] | 101 | @( time { source envars && \$(CMDSDIR)/$file >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\
|
---|
| 102 | \$(PRT_DU_CR) >>logs/\$@
|
---|
[401f81e] | 103 | EOF
|
---|
| 104 | ) >> $MKFILE.tmp
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | #----------------------------------#
|
---|
[045b2dc] | 108 | ROOT_Unpack() { # An alias, for clairity
|
---|
[401f81e] | 109 | #----------------------------------#
|
---|
[045b2dc] | 110 | local FILE=$1
|
---|
| 111 | local optSAVE_PREVIOUS=$2
|
---|
| 112 |
|
---|
| 113 | if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then
|
---|
[401f81e] | 114 | (
|
---|
[045b2dc] | 115 | cat << EOF
|
---|
| 116 | @\$(call remove_existing_dirs,$FILE)
|
---|
[401f81e] | 117 | EOF
|
---|
| 118 | ) >> $MKFILE.tmp
|
---|
[045b2dc] | 119 | fi
|
---|
[401f81e] | 120 |
|
---|
| 121 | (
|
---|
[045b2dc] | 122 | cat << EOF
|
---|
| 123 | @\$(call unpack,$FILE)
|
---|
| 124 | @\$(call get_pkg_root_LUSER)
|
---|
[401f81e] | 125 | EOF
|
---|
| 126 | ) >> $MKFILE.tmp
|
---|
| 127 | }
|
---|
| 128 |
|
---|
[045b2dc] | 129 | #------------------------------------------------------#
|
---|
| 130 | #------------------------------------------------------#
|
---|
[401f81e] | 131 |
|
---|
| 132 | #----------------------------------#
|
---|
[045b2dc] | 133 | LUSER_wrt_target() { # Create target and initialize log file
|
---|
[401f81e] | 134 | #----------------------------------#
|
---|
| 135 | local i=$1
|
---|
[045b2dc] | 136 | local PREV=$2
|
---|
[401f81e] | 137 | (
|
---|
[045b2dc] | 138 | cat << EOF
|
---|
| 139 |
|
---|
| 140 | $i: $PREV
|
---|
| 141 | @\$(call echo_message, Building)
|
---|
| 142 | @./progress_bar.sh \$@ \$\$PPID &
|
---|
[91bac7f] | 143 | @echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@
|
---|
[8bea2c8] | 144 | @\$(PRT_DU) >>logs/\$@
|
---|
[5842156] | 145 | EOF
|
---|
| 146 | ) >> $MKFILE.tmp
|
---|
| 147 | }
|
---|
| 148 |
|
---|
| 149 |
|
---|
[401f81e] | 150 | #----------------------------------#
|
---|
[045b2dc] | 151 | LUSER_wrt_RunAsUser() { # Execute script inside time { }, footer to log file
|
---|
[401f81e] | 152 | #----------------------------------#
|
---|
[045b2dc] | 153 | local file=$1
|
---|
| 154 |
|
---|
[401f81e] | 155 | (
|
---|
| 156 | cat << EOF
|
---|
[045b2dc] | 157 | @( time { source ~/.bashrc && \$(CMDSDIR)/`dirname $file`/\$@ >> logs/\$@ 2>&1; } ) 2>> logs/\$@ && \\
|
---|
| 158 | \$(PRT_DU) >> logs/\$@
|
---|
[401f81e] | 159 | EOF
|
---|
| 160 | ) >> $MKFILE.tmp
|
---|
| 161 | }
|
---|
| 162 |
|
---|
[045b2dc] | 163 |
|
---|
[877cc6a] | 164 | #----------------------------------#
|
---|
[045b2dc] | 165 | LUSER_wrt_unpack() { # Unpack and set 'ROOT' var
|
---|
[877cc6a] | 166 | #----------------------------------#
|
---|
| 167 | local FILE=$1
|
---|
[5842156] | 168 | local optSAVE_PREVIOUS=$2
|
---|
[82eb8c1] | 169 |
|
---|
[401f81e] | 170 | if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then
|
---|
| 171 | (
|
---|
| 172 | cat << EOF
|
---|
| 173 | @\$(call remove_existing_dirs,$FILE)
|
---|
| 174 | EOF
|
---|
| 175 | ) >> $MKFILE.tmp
|
---|
[5842156] | 176 | fi
|
---|
[401f81e] | 177 |
|
---|
[877cc6a] | 178 | (
|
---|
| 179 | cat << EOF
|
---|
| 180 | @\$(call unpack,$FILE)
|
---|
[045b2dc] | 181 | @\$(call get_pkg_root_LUSER)
|
---|
[e5f5970] | 182 | EOF
|
---|
| 183 | ) >> $MKFILE.tmp
|
---|
| 184 |
|
---|
[401f81e] | 185 | }
|
---|
[e5f5970] | 186 |
|
---|
[045b2dc] | 187 |
|
---|
[877cc6a] | 188 | #----------------------------------#
|
---|
[045b2dc] | 189 | LUSER_wrt_CopyFstab() { #
|
---|
[877cc6a] | 190 | #----------------------------------#
|
---|
[401f81e] | 191 | (
|
---|
| 192 | cat << EOF
|
---|
[045b2dc] | 193 | @( time { cp -v \$(MOUNT_PT)/sources/fstab \$(MOUNT_PT)/etc/fstab >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@
|
---|
[877cc6a] | 194 | EOF
|
---|
| 195 | ) >> $MKFILE.tmp
|
---|
| 196 | }
|
---|
| 197 |
|
---|
[045b2dc] | 198 |
|
---|
[261eea6] | 199 | #----------------------------------#
|
---|
[045b2dc] | 200 | LUSER_wrt_test_log() { # Initialize testsuite log file
|
---|
[261eea6] | 201 | #----------------------------------#
|
---|
[045b2dc] | 202 | local TESTLOGFILE=$1
|
---|
[877cc6a] | 203 | (
|
---|
| 204 | cat << EOF
|
---|
[045b2dc] | 205 | @echo "export TEST_LOG=$TESTLOGDIR/$TESTLOGFILE" >> envars && \\
|
---|
[91bac7f] | 206 | echo '\$(nl_)\`date\`\$(nl_)' >$TESTLOGDIR/$TESTLOGFILE
|
---|
[877cc6a] | 207 | EOF
|
---|
| 208 | ) >> $MKFILE.tmp
|
---|
| 209 | }
|
---|
| 210 |
|
---|
[401f81e] | 211 |
|
---|
[a229600] | 212 | #----------------------------------#
|
---|
[045b2dc] | 213 | LUSER_RemoveBuildDirs() { #
|
---|
[a229600] | 214 | #----------------------------------#
|
---|
[401f81e] | 215 | local name=$1
|
---|
[a229600] | 216 | (
|
---|
[401f81e] | 217 | cat << EOF
|
---|
| 218 | @\$(call remove_build_dirs,$name)
|
---|
[a229600] | 219 | EOF
|
---|
| 220 | ) >> $MKFILE.tmp
|
---|
| 221 | }
|
---|
| 222 |
|
---|
[045b2dc] | 223 | #-----------------------------------------------------------------#
|
---|
| 224 | #-----------------------------------------------------------------#
|
---|
| 225 |
|
---|
[a229600] | 226 | #----------------------------------#
|
---|
[045b2dc] | 227 | CHROOT_wrt_target() { # Create target and initialize log file
|
---|
[a229600] | 228 | #----------------------------------#
|
---|
[045b2dc] | 229 | local i=$1
|
---|
| 230 | local PREV=$2
|
---|
| 231 | case $i in
|
---|
| 232 | iteration* ) local LOGFILE="${this_script}.log" ;;
|
---|
[8bea2c8] | 233 | * ) local LOGFILE="\$@" ;;
|
---|
[045b2dc] | 234 | esac
|
---|
[a229600] | 235 | (
|
---|
[401f81e] | 236 | cat << EOF
|
---|
[045b2dc] | 237 |
|
---|
| 238 | $i: $PREV
|
---|
| 239 | @\$(call echo_message, Building)
|
---|
| 240 | @./progress_bar.sh \$@ \$\$PPID &
|
---|
[91bac7f] | 241 | @echo "\$(nl_)\`date\`\$(nl_)" >logs/$LOGFILE
|
---|
[8bea2c8] | 242 | @\$(PRT_DU_CR) >>logs/$LOGFILE
|
---|
[a229600] | 243 | EOF
|
---|
| 244 | ) >> $MKFILE.tmp
|
---|
| 245 | }
|
---|
| 246 |
|
---|
[401f81e] | 247 |
|
---|
[877cc6a] | 248 | #----------------------------------#
|
---|
[045b2dc] | 249 | CHROOT_Unpack() { #
|
---|
[877cc6a] | 250 | #----------------------------------#
|
---|
[045b2dc] | 251 | local FILE=$1
|
---|
| 252 | local optSAVE_PREVIOUS=$2
|
---|
| 253 |
|
---|
| 254 | if [ "${optSAVE_PREVIOUS}" != "1" ]; then
|
---|
[877cc6a] | 255 | (
|
---|
[401f81e] | 256 | cat << EOF
|
---|
[045b2dc] | 257 | @\$(call remove_existing_dirs2,$FILE)
|
---|
[877cc6a] | 258 | EOF
|
---|
| 259 | ) >> $MKFILE.tmp
|
---|
[045b2dc] | 260 | fi
|
---|
[877cc6a] | 261 | (
|
---|
[045b2dc] | 262 | cat << EOF
|
---|
| 263 | @\$(call unpack3,$FILE)
|
---|
| 264 | @\$(call get_pkg_root2)
|
---|
[877cc6a] | 265 | EOF
|
---|
| 266 | ) >> $MKFILE.tmp
|
---|
| 267 | }
|
---|
| 268 |
|
---|
| 269 |
|
---|
[e5f5970] | 270 | #----------------------------------#
|
---|
[045b2dc] | 271 | CHROOT_wrt_test_log() { #
|
---|
[e5f5970] | 272 | #----------------------------------#
|
---|
[045b2dc] | 273 | local TESTLOGFILE=$1
|
---|
[ac1d897] | 274 | (
|
---|
[045b2dc] | 275 | cat << EOF
|
---|
| 276 | @echo "export TEST_LOG=/\$(SCRIPT_ROOT)/test-logs/$TESTLOGFILE" >> envars && \\
|
---|
[91bac7f] | 277 | echo "\$(nl_)\`date\`\$(nl_)" >test-logs/$TESTLOGFILE
|
---|
[ac1d897] | 278 | EOF
|
---|
| 279 | ) >> $MKFILE.tmp
|
---|
| 280 | }
|
---|
| 281 |
|
---|
[045b2dc] | 282 |
|
---|
[261eea6] | 283 | #----------------------------------#
|
---|
[045b2dc] | 284 | CHROOT_wrt_RunAsRoot() { #
|
---|
[261eea6] | 285 | #----------------------------------#
|
---|
[045b2dc] | 286 | local file=$1
|
---|
[877cc6a] | 287 | (
|
---|
| 288 | cat << EOF
|
---|
[8bea2c8] | 289 | @( time { source envars && \$(crCMDSDIR)/$file >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\
|
---|
| 290 | \$(PRT_DU_CR) >>logs/\$@
|
---|
[877cc6a] | 291 | EOF
|
---|
| 292 | ) >> $MKFILE.tmp
|
---|
[045b2dc] | 293 |
|
---|
[877cc6a] | 294 | }
|
---|
| 295 |
|
---|
| 296 |
|
---|
| 297 | #----------------------------------#
|
---|
[045b2dc] | 298 | CHROOT_wrt_CopyFstab() { #
|
---|
[877cc6a] | 299 | #----------------------------------#
|
---|
| 300 | (
|
---|
[401f81e] | 301 | cat << EOF
|
---|
[8bea2c8] | 302 | @( time { cp -v /sources/fstab /etc/fstab >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@
|
---|
[877cc6a] | 303 | EOF
|
---|
| 304 | ) >> $MKFILE.tmp
|
---|
| 305 | }
|
---|
| 306 |
|
---|
[045b2dc] | 307 |
|
---|
[877cc6a] | 308 | #----------------------------------#
|
---|
[045b2dc] | 309 | CHROOT_wrt_RemoveBuildDirs() { #
|
---|
[877cc6a] | 310 | #----------------------------------#
|
---|
[045b2dc] | 311 | local name=$1
|
---|
[877cc6a] | 312 | (
|
---|
| 313 | cat << EOF
|
---|
[045b2dc] | 314 | @\$(call remove_build_dirs2,$name)
|
---|
[877cc6a] | 315 | EOF
|
---|
| 316 | ) >> $MKFILE.tmp
|
---|
| 317 | }
|
---|
| 318 |
|
---|
[045b2dc] | 319 |
|
---|
| 320 | unset wrt_touch
|
---|
[877cc6a] | 321 | #----------------------------------#
|
---|
[045b2dc] | 322 | wrt_touch() { #
|
---|
[877cc6a] | 323 | #----------------------------------#
|
---|
[0bdf6ed] | 324 | (
|
---|
| 325 | cat << EOF
|
---|
[045b2dc] | 326 | @\$(call housekeeping)
|
---|
[e2ef100] | 327 | EOF
|
---|
| 328 | ) >> $MKFILE.tmp
|
---|
| 329 | }
|
---|
| 330 |
|
---|
[045b2dc] | 331 |
|
---|
[453bef0] | 332 | #----------------------------------#
|
---|
[045b2dc] | 333 | wrt_blfs_tool_targets() { #
|
---|
[453bef0] | 334 | #----------------------------------#
|
---|
| 335 |
|
---|
[045b2dc] | 336 | echo "${tab_}${GREEN}Processing... ${L_arrow}BLFS_TOOL ${R_arrow}"
|
---|
| 337 |
|
---|
| 338 | for file in blfs-tool-deps/* ; do
|
---|
| 339 | # Keep the script file name
|
---|
| 340 | this_script=`basename $file`
|
---|
| 341 |
|
---|
| 342 | # Grab the name of the target
|
---|
| 343 | name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@'`
|
---|
| 344 |
|
---|
| 345 | # Find the package.
|
---|
| 346 | case $name in
|
---|
| 347 | tidy ) pkg_tarball=${TIDY_PKG} ;;
|
---|
| 348 | unzip ) pkg_tarball=${UNZIP_PKG} ;;
|
---|
| 349 | * ) pkg_tarball=$(get_package_tarball_name $name) ;;
|
---|
| 350 | esac
|
---|
| 351 |
|
---|
| 352 | # Append each name of the script files to a list (this will become
|
---|
| 353 | # the names of the targets in the Makefile)
|
---|
| 354 | blfs_tool="$blfs_tool ${this_script}"
|
---|
| 355 |
|
---|
| 356 | #--------------------------------------------------------------------#
|
---|
| 357 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 358 | #--------------------------------------------------------------------#
|
---|
| 359 | #
|
---|
| 360 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 361 | # as a dependency. Also call the echo_message function.
|
---|
| 362 | CHROOT_wrt_target "${this_script}" "$PREV"
|
---|
| 363 |
|
---|
| 364 | # Insert instructions for unpacking the package and changing directories
|
---|
| 365 | # DocBook-XML is a zip, the build script will handle that.
|
---|
| 366 | [[ ! "$name" = "docbook-xml" ]] && CHROOT_Unpack "$pkg_tarball"
|
---|
| 367 |
|
---|
| 368 | # Run the script.
|
---|
| 369 | CHROOT_wrt_RunAsRoot "$file"
|
---|
| 370 |
|
---|
| 371 | # Remove the build directory(ies) except if the package build fails.
|
---|
| 372 | [[ ! "$name" = "docbook-xml" ]] && CHROOT_wrt_RemoveBuildDirs "$name"
|
---|
| 373 |
|
---|
| 374 | # Touch the tracking file.
|
---|
| 375 | case $name in
|
---|
| 376 | tidy ) pkg_ver=tidy-051026 ;;
|
---|
| 377 | unzip ) pkg_ver=unzip-5.52 ;;
|
---|
| 378 | * ) pkg_ver=$(echo $pkg_tarball | sed -e 's/.tar.*//;s/.tgz//;s/.zip//') ;;
|
---|
| 379 | esac
|
---|
[91bac7f] | 380 | echo "\$(tab_)@touch $TRACKING_DIR/$pkg_ver" >> $MKFILE.tmp
|
---|
[045b2dc] | 381 |
|
---|
| 382 | # Include a touch of the target name so make can check
|
---|
| 383 | # if it's already been made.
|
---|
| 384 | wrt_touch
|
---|
| 385 | #
|
---|
| 386 | #--------------------------------------------------------------------#
|
---|
| 387 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 388 | #--------------------------------------------------------------------#
|
---|
| 389 |
|
---|
| 390 | # Keep the script file name for Makefile dependencies.
|
---|
| 391 | PREV=${this_script}
|
---|
| 392 | done
|
---|
[453bef0] | 393 | }
|
---|
| 394 |
|
---|
[045b2dc] | 395 | #------------------------------------------------------#
|
---|
| 396 | # END Makefile scripting functions #
|
---|
| 397 | #------------------------------------------------------#
|
---|
| 398 |
|
---|
[453bef0] | 399 |
|
---|
[401f81e] | 400 |
|
---|
[877cc6a] | 401 | #----------------------------#
|
---|
[261eea6] | 402 | run_make() { #
|
---|
[877cc6a] | 403 | #----------------------------#
|
---|
| 404 | # Test if make must be run.
|
---|
[401f81e] | 405 | if [ "$RUNMAKE" = "y" ] ; then
|
---|
[877cc6a] | 406 | # Test to make sure we're running the build as root
|
---|
[045b2dc] | 407 | if [ "$UID" = "0" ] ; then
|
---|
| 408 | echo "You must not be logged in as root to build the system."
|
---|
[877cc6a] | 409 | exit 1
|
---|
| 410 | fi
|
---|
| 411 | # Build the system
|
---|
| 412 | if [ -e $MKFILE ] ; then
|
---|
| 413 | echo -ne "Building the system...\n"
|
---|
[a167246] | 414 | cd $JHALFSDIR && make
|
---|
[877cc6a] | 415 | echo -ne "done\n"
|
---|
| 416 | fi
|
---|
| 417 | fi
|
---|
| 418 | }
|
---|
| 419 |
|
---|
| 420 |
|
---|
| 421 | #----------------------------#
|
---|
[261eea6] | 422 | clean_builddir() { #
|
---|
[877cc6a] | 423 | #----------------------------#
|
---|
| 424 | # Test if the clean must be done.
|
---|
[401f81e] | 425 | if [ "${CLEAN}" = "y" ]; then
|
---|
[877cc6a] | 426 | # Test to make sure that the build directory was populated by jhalfs
|
---|
| 427 | if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
|
---|
[5468631] | 428 | echo "Looks like $BUILDDIR was not populated by a previous jhalfs run."
|
---|
[877cc6a] | 429 | exit 1
|
---|
| 430 | else
|
---|
| 431 | # Clean the build directory
|
---|
[5468631] | 432 | echo -n "Cleaning $BUILDDIR ..."
|
---|
| 433 | sudo rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,cross-tools,usr,var}
|
---|
| 434 | echo "done"
|
---|
| 435 | echo -n "Cleaning $JHALFSDIR ..."
|
---|
| 436 | sudo rm -rf $JHALFSDIR
|
---|
| 437 | echo "done"
|
---|
| 438 | echo -n "Cleaning remainig extracted sources in $BUILDDIR/sources ..."
|
---|
| 439 | sudo rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d`
|
---|
| 440 | echo "done"
|
---|
[877cc6a] | 441 | fi
|
---|
| 442 | fi
|
---|
| 443 | }
|
---|
| 444 |
|
---|
| 445 | #----------------------------#
|
---|
[261eea6] | 446 | get_book() { #
|
---|
[877cc6a] | 447 | #----------------------------#
|
---|
| 448 | cd $JHALFSDIR
|
---|
| 449 |
|
---|
[4da2512] | 450 | if [ -z $WORKING_COPY ] ; then
|
---|
[877cc6a] | 451 | # Check for Subversion instead of just letting the script hit 'svn' and fail.
|
---|
| 452 | test `type -p svn` || eval "echo \"This feature requires Subversion.\"
|
---|
| 453 | exit 1"
|
---|
| 454 | echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
|
---|
| 455 |
|
---|
| 456 | case $PROGNAME in
|
---|
| 457 | lfs) svn_root="LFS" ;;
|
---|
| 458 | hlfs) svn_root="HLFS" ;;
|
---|
| 459 | clfs) svn_root="cross-lfs" ;;
|
---|
[7432834] | 460 | clfs2) svn_root="cross-lfs" ;;
|
---|
[2639f65] | 461 | clfs3) svn_root="cross-lfs" ;;
|
---|
[877cc6a] | 462 | *) echo "BOOK not defined in function <get_book>"
|
---|
| 463 | exit 1 ;;
|
---|
| 464 | esac
|
---|
| 465 | # Grab a fresh book if it's missing, otherwise, update it from the
|
---|
| 466 | # repo. If we've already extracted the commands, move on to getting the
|
---|
| 467 | # sources.
|
---|
| 468 | if [ -d ${PROGNAME}-$LFSVRS ] ; then
|
---|
| 469 | cd ${PROGNAME}-$LFSVRS
|
---|
[1ff6768] | 470 | if LC_ALL=C svn up | grep -q At && \
|
---|
| 471 | test -d $JHALFSDIR/${PROGNAME}-commands && \
|
---|
| 472 | test -f $JHALFSDIR/pkg_tarball_list ; then
|
---|
[877cc6a] | 473 | # Set the canonical book version
|
---|
[a6655ff] | 474 | echo -ne "done\n"
|
---|
[877cc6a] | 475 | cd $JHALFSDIR
|
---|
[1ff6768] | 476 | case $PROGNAME in
|
---|
[2639f65] | 477 | clfs | clfs2 | clfs3 )
|
---|
[1ff6768] | 478 | VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
| 479 | *)
|
---|
| 480 | VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
| 481 | esac
|
---|
[877cc6a] | 482 | get_sources
|
---|
| 483 | else
|
---|
| 484 | echo -ne "done\n"
|
---|
| 485 | extract_commands
|
---|
| 486 | fi
|
---|
| 487 | else
|
---|
[cb39f79] | 488 | svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
---|
[877cc6a] | 489 | echo -ne "done\n"
|
---|
| 490 | extract_commands
|
---|
| 491 | fi
|
---|
[1ff6768] | 492 |
|
---|
[877cc6a] | 493 | else
|
---|
| 494 | echo -ne "Using $BOOK as book's sources ...\n"
|
---|
| 495 | extract_commands
|
---|
| 496 | fi
|
---|
[a6655ff] | 497 | echo -ne " Document version ${L_arrow}${BOLD}${VERSION}${R_arrow}\n"
|
---|
[877cc6a] | 498 | }
|
---|
| 499 |
|
---|
| 500 | #----------------------------#
|
---|
| 501 | extract_commands() { #
|
---|
| 502 | #----------------------------#
|
---|
| 503 |
|
---|
| 504 | # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
|
---|
| 505 | test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
|
---|
| 506 | exit 1"
|
---|
| 507 |
|
---|
| 508 | cd $JHALFSDIR
|
---|
[1ff6768] | 509 | case $PROGNAME in
|
---|
[7432834] | 510 | clfs | clfs2 )
|
---|
[1ff6768] | 511 | VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
| 512 | *)
|
---|
| 513 | VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
| 514 | esac
|
---|
[877cc6a] | 515 |
|
---|
| 516 | # Start clean
|
---|
[bfc07d6] | 517 | if [ -d ${PROGNAME}-commands ]; then
|
---|
| 518 | rm -rf ${PROGNAME}-commands
|
---|
| 519 | mkdir -v ${PROGNAME}-commands
|
---|
[877cc6a] | 520 | fi
|
---|
| 521 | echo -n "Extracting commands for"
|
---|
| 522 |
|
---|
| 523 | # Dump the commands in shell script form from the HLFS book.
|
---|
| 524 | case ${PROGNAME} in
|
---|
| 525 | clfs)
|
---|
| 526 | echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
|
---|
| 527 | xsltproc --nonet \
|
---|
| 528 | --xinclude \
|
---|
| 529 | --stringparam method $METHOD \
|
---|
| 530 | --stringparam testsuite $TEST \
|
---|
[28f4756] | 531 | --stringparam bomb-testsuite $BOMB_TEST \
|
---|
[877cc6a] | 532 | --stringparam vim-lang $VIMLANG \
|
---|
| 533 | --stringparam timezone $TIMEZONE \
|
---|
| 534 | --stringparam page $PAGE \
|
---|
| 535 | --stringparam lang $LANG \
|
---|
| 536 | -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 537 | ;;
|
---|
[7432834] | 538 |
|
---|
| 539 | clfs2)
|
---|
| 540 | echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
|
---|
| 541 | xsltproc --nonet \
|
---|
| 542 | --xinclude \
|
---|
| 543 | --stringparam vim-lang $VIMLANG \
|
---|
| 544 | --stringparam timezone $TIMEZONE \
|
---|
| 545 | --stringparam page $PAGE \
|
---|
| 546 | --stringparam lang $LANG \
|
---|
| 547 | -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 548 | ;;
|
---|
[2639f65] | 549 |
|
---|
| 550 | clfs3)
|
---|
| 551 | echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
|
---|
| 552 | xsltproc --nonet \
|
---|
| 553 | --xinclude \
|
---|
| 554 | --stringparam vim-lang $VIMLANG \
|
---|
| 555 | --stringparam timezone $TIMEZONE \
|
---|
| 556 | --stringparam page $PAGE \
|
---|
| 557 | --stringparam lang $LANG \
|
---|
| 558 | -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 559 | ;;
|
---|
| 560 |
|
---|
[877cc6a] | 561 | hlfs)
|
---|
| 562 | echo -n " ${L_arrow}${BOLD}$MODEL${R_arrow} HLFS libc implementation"
|
---|
| 563 | xsltproc --nonet \
|
---|
| 564 | --xinclude \
|
---|
| 565 | --stringparam model $MODEL \
|
---|
| 566 | --stringparam testsuite $TEST \
|
---|
[28f4756] | 567 | --stringparam bomb-testsuite $BOMB_TEST \
|
---|
[877cc6a] | 568 | --stringparam timezone $TIMEZONE \
|
---|
| 569 | --stringparam page $PAGE \
|
---|
| 570 | --stringparam lang $LANG \
|
---|
| 571 | --stringparam lc_all $LC_ALL \
|
---|
| 572 | --stringparam grsecurity_host $GRSECURITY_HOST \
|
---|
| 573 | -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 574 | ;;
|
---|
| 575 | lfs)
|
---|
| 576 | echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build"
|
---|
| 577 | xsltproc --nonet \
|
---|
| 578 | --xinclude \
|
---|
| 579 | --stringparam testsuite $TEST \
|
---|
[28f4756] | 580 | --stringparam bomb-testsuite $BOMB_TEST \
|
---|
[877cc6a] | 581 | --stringparam vim-lang $VIMLANG \
|
---|
| 582 | --stringparam timezone $TIMEZONE \
|
---|
| 583 | --stringparam page $PAGE \
|
---|
| 584 | --stringparam lang $LANG \
|
---|
| 585 | -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 586 | ;;
|
---|
[2639f65] | 587 | *) echo -n " ${L_arrow}${BOLD}${PROGNAME}${R_arrow} book invalid, terminate build"
|
---|
| 588 | exit 1 ;;
|
---|
[877cc6a] | 589 | esac
|
---|
| 590 |
|
---|
[4965fa8] | 591 | [[ "${BLFS_TOOL}" = "y" ]] && copy_blfs_deps_scripts
|
---|
| 592 |
|
---|
[877cc6a] | 593 | echo " ...OK"
|
---|
| 594 |
|
---|
| 595 | # Make the scripts executable.
|
---|
| 596 | chmod -R +x $JHALFSDIR/${PROGNAME}-commands
|
---|
| 597 |
|
---|
[15cad16] | 598 | # Create the packages file. We need it for proper Makefile creation
|
---|
[dd29d02] | 599 | create_package_list
|
---|
[877cc6a] | 600 |
|
---|
| 601 | # Done. Moving on...
|
---|
| 602 | get_sources
|
---|
[045b2dc] | 603 |
|
---|
[877cc6a] | 604 | }
|
---|
| 605 |
|
---|
[dd29d02] | 606 | #----------------------------#
|
---|
| 607 | create_package_list() { #
|
---|
| 608 | #----------------------------#
|
---|
| 609 |
|
---|
| 610 | # Create the packages file. We need it for proper Makefile creation
|
---|
| 611 | rm -f pkg_tarball_list
|
---|
| 612 | echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK $ARCH"
|
---|
| 613 | case ${PROGNAME} in
|
---|
[2639f65] | 614 | clfs | clfs2 | clfs3 )
|
---|
[dd29d02] | 615 | xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
|
---|
| 616 | $BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 617 | ;;
|
---|
| 618 | hlfs)
|
---|
| 619 | xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
|
---|
| 620 | $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 621 | ;;
|
---|
| 622 | lfs)
|
---|
| 623 | xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
|
---|
| 624 | $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 625 | ;;
|
---|
| 626 | esac
|
---|
[4965fa8] | 627 |
|
---|
| 628 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
| 629 | (
|
---|
| 630 | cat << EOF
|
---|
| 631 | $LIBXML_PKG
|
---|
| 632 | $LIBXSLT_PKG
|
---|
[045b2dc] | 633 | $TIDY_PKG
|
---|
| 634 | $UNZIP_PKG
|
---|
| 635 | $DBXML_PKG
|
---|
[4965fa8] | 636 | $DBXSL_PKG
|
---|
| 637 | $LINKS_PKG
|
---|
| 638 | $SUDO_PKG
|
---|
| 639 | $WGET_PKG
|
---|
| 640 | $SVN_PKG
|
---|
| 641 | $GPM_PKG
|
---|
| 642 | EOF
|
---|
| 643 | ) >> pkg_tarball_list
|
---|
| 644 | fi
|
---|
| 645 |
|
---|
[dd29d02] | 646 | echo " ...OK"
|
---|
| 647 |
|
---|
| 648 | }
|
---|
| 649 |
|
---|
| 650 |
|
---|
[877cc6a] | 651 | #----------------------------#
|
---|
[15cad16] | 652 | get_sources() { # Download file, write name to MISSING_FILES.DMP if an error
|
---|
[93135fd] | 653 | #----------------------------#
|
---|
| 654 | local saveIFS=$IFS
|
---|
[26053c4] | 655 | local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE
|
---|
[93135fd] | 656 |
|
---|
| 657 | # Test if the packages must be downloaded
|
---|
[401f81e] | 658 | [ ! "$GETPKG" = "y" ] && return
|
---|
[93135fd] | 659 |
|
---|
| 660 | gs_wrt_message(){
|
---|
| 661 | echo "${RED}$1${OFF}"
|
---|
[c7dbe78] | 662 | echo "$1" >> MISSING_FILES.DMP
|
---|
| 663 | }
|
---|
[93135fd] | 664 | # Housekeeping
|
---|
| 665 | [[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources
|
---|
| 666 | cd $BUILDDIR/sources
|
---|
| 667 | [[ -f MD5SUMS ]] && rm MD5SUMS
|
---|
| 668 | [[ -f MISSING_FILES.DMP ]] && rm MISSING_FILES.DMP
|
---|
| 669 | [[ -f urls.lst ]] && rm urls.lst
|
---|
| 670 |
|
---|
| 671 | # Generate URLs file
|
---|
| 672 | create_urls
|
---|
| 673 |
|
---|
| 674 | IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only
|
---|
| 675 | for line in `cat urls.lst`; do
|
---|
| 676 | IFS=$saveIFS # Restore the system defaults
|
---|
| 677 |
|
---|
| 678 | # Skip some packages if they aren't needed
|
---|
| 679 | case $line in
|
---|
| 680 | */tcl* | */expect* | */dejagnu* | */tree* | */gcc-testsuite* )
|
---|
| 681 | [[ "$TEST" = "0" ]] && continue
|
---|
| 682 | ;;
|
---|
| 683 | */vim-*-lang* )
|
---|
| 684 | [[ "$VIMLANG" = "0" ]] && continue
|
---|
| 685 | ;;
|
---|
[0c3f2f9] | 686 | *linux/linux-* )
|
---|
[294c937] | 687 | [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] && \
|
---|
[401f81e] | 688 | [[ "$GETKERNEL" = "n" ]] && continue
|
---|
[0c3f2f9] | 689 | ;;
|
---|
[93135fd] | 690 | esac
|
---|
| 691 |
|
---|
| 692 | # Locations
|
---|
[296ae69] | 693 | URL1=`echo $line | cut -d" " -f2` # Preferred URL
|
---|
| 694 | URL2=`echo $line | cut -d" " -f1` # Fallback Upstream URL
|
---|
[26053c4] | 695 | FILE=`basename $URL1` # File name
|
---|
| 696 | BOOKMD5=`echo $line | cut -d" " -f3` # MD5 book value
|
---|
| 697 |
|
---|
[8a43b5b] | 698 | # Validation pair
|
---|
| 699 | MD5="$BOOKMD5 $FILE"
|
---|
| 700 | HAVEMD5=1
|
---|
[93135fd] | 701 |
|
---|
| 702 | set -e
|
---|
[c7dbe78] | 703 | # If the file exists in the archive copy it to the
|
---|
[93135fd] | 704 | # $BUILDDIR/sources dir. MD5SUM will be validated later.
|
---|
| 705 | if [ ! -z ${SRC_ARCHIVE} ] &&
|
---|
| 706 | [ -d ${SRC_ARCHIVE} ] &&
|
---|
| 707 | [ -f ${SRC_ARCHIVE}/$FILE ]; then
|
---|
| 708 | cp ${SRC_ARCHIVE}/$FILE .
|
---|
| 709 | echo "$FILE: -- copied from $SRC_ARCHIVE"
|
---|
| 710 | fromARCHIVE=1
|
---|
| 711 | else
|
---|
| 712 | echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE}${OFF}"
|
---|
| 713 | fromARCHIVE=0
|
---|
[8a43b5b] | 714 | # If the file does not exist yet in /sources download a fresh one
|
---|
[93135fd] | 715 | if [ ! -f $FILE ] ; then
|
---|
| 716 | if ! wget $URL1 && ! wget $URL2 ; then
|
---|
[c7dbe78] | 717 | gs_wrt_message "$FILE not found in the SRC_ARCHIVE or on any server..SKIPPING"
|
---|
| 718 | continue
|
---|
[93135fd] | 719 | fi
|
---|
| 720 | fi
|
---|
| 721 | fi
|
---|
| 722 |
|
---|
[8a43b5b] | 723 | # IF the md5sum does not match the existing files
|
---|
| 724 | if ! echo "$MD5" | md5sum -c - >/dev/null ; then
|
---|
| 725 | [[ $fromARCHIVE = "1" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match SRC_ARCHIVE copy${OFF}"
|
---|
| 726 | [[ $fromARCHIVE = "0" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}"
|
---|
| 727 | # Remove the old file and download a new one
|
---|
| 728 | rm -fv $FILE
|
---|
| 729 | # Force storage in SRC_ARCHIVE
|
---|
| 730 | fromARCHIVE=0;
|
---|
| 731 | # Try to retrieve again the file. Servers in reverse order.
|
---|
| 732 | if ! wget $URL2 && ! wget $URL1 ; then
|
---|
| 733 | gs_wrt_message "$FILE not found on the servers.. SKIPPING"
|
---|
| 734 | continue
|
---|
[93135fd] | 735 | fi
|
---|
| 736 | fi
|
---|
| 737 |
|
---|
| 738 | # Validate the MD5SUM one last time
|
---|
[8a43b5b] | 739 | if ! echo "$MD5" | md5sum -c - >/dev/null ; then
|
---|
[93135fd] | 740 | gs_wrt_message "$FILE does not match MD5SUMS value"
|
---|
[0910f55] | 741 | # Force generation of MD5SUM
|
---|
| 742 | HAVEMD5=0
|
---|
[93135fd] | 743 | fi
|
---|
| 744 |
|
---|
| 745 | # Generate a fresh MD5SUM for this file
|
---|
| 746 | if [[ "$HAVEMD5" = "0" ]] ; then
|
---|
| 747 | echo "${BOLD}${YELLOW}Generating a new MD5SUM for ${OFF}$FILE"
|
---|
[8a43b5b] | 748 | echo "NEW MD5SUM: $(md5sum $FILE)" >> MISSING_FILES.DMP
|
---|
[93135fd] | 749 | fi
|
---|
| 750 |
|
---|
| 751 | # Good or bad we write the original md5sum to a file
|
---|
[8a43b5b] | 752 | echo "$MD5" >> MD5SUMS
|
---|
[93135fd] | 753 |
|
---|
| 754 | # Copy the freshly downloaded file
|
---|
| 755 | # to the source archive.
|
---|
| 756 | if [ ! -z ${SRC_ARCHIVE} ] &&
|
---|
| 757 | [ -d ${SRC_ARCHIVE} ] &&
|
---|
| 758 | [ -w ${SRC_ARCHIVE} ] &&
|
---|
| 759 | [ "$fromARCHIVE" = "0" ] ; then
|
---|
| 760 | echo "Storing file:<$FILE> in the package archive"
|
---|
| 761 | cp -f $FILE ${SRC_ARCHIVE}
|
---|
| 762 | fi
|
---|
| 763 |
|
---|
| 764 | done
|
---|
| 765 |
|
---|
| 766 | if [[ -s MISSING_FILES.DMP ]]; then
|
---|
[d385453] | 767 | echo -e "\n\n${tab_}${RED} One or more files were not retrieved or have bad MD5SUMS.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n"
|
---|
| 768 | # Do not allow the automatic execution of the Makefile.
|
---|
[261eea6] | 769 | echo "${tab_}${BOLD}${RED}*** ${YELLOW}Automatic execution of the generated makefile has been inhibited. ${RED}***${OFF}${nl_}"
|
---|
[401f81e] | 770 | RUNMAKE="n"
|
---|
[93135fd] | 771 | fi
|
---|
| 772 | }
|
---|
| 773 |
|
---|
[877cc6a] | 774 | #----------------------------#
|
---|
[15cad16] | 775 | create_urls() { #
|
---|
[877cc6a] | 776 | #----------------------------#
|
---|
[15cad16] | 777 | cd $JHALFSDIR
|
---|
[877cc6a] | 778 |
|
---|
[15cad16] | 779 | case ${PROGNAME} in
|
---|
| 780 | clfs)
|
---|
| 781 | echo -n "Creating CLFS <${ARCH}> specific URLs file"
|
---|
| 782 | xsltproc --nonet --xinclude \
|
---|
| 783 | --stringparam server $SERVER \
|
---|
| 784 | -o $BUILDDIR/sources/urls.lst urls.xsl \
|
---|
| 785 | $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 786 | echo " ...OK"
|
---|
| 787 | ;;
|
---|
[7432834] | 788 | clfs2)
|
---|
| 789 | echo -n "Creating CLFS2 <${ARCH}> specific URLs file"
|
---|
| 790 | xsltproc --nonet --xinclude \
|
---|
| 791 | --stringparam server $SERVER \
|
---|
| 792 | -o $BUILDDIR/sources/urls.lst urls.xsl \
|
---|
| 793 | $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 794 | echo " ...OK"
|
---|
| 795 | ;;
|
---|
[2639f65] | 796 | clfs3)
|
---|
| 797 | echo -n "Creating CLFS3 <${ARCH}> specific URLs file"
|
---|
| 798 | xsltproc --nonet --xinclude \
|
---|
| 799 | --stringparam server $SERVER \
|
---|
| 800 | -o $BUILDDIR/sources/urls.lst urls.xsl \
|
---|
| 801 | $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 802 | echo " ...OK"
|
---|
| 803 | ;;
|
---|
[15cad16] | 804 | hlfs)
|
---|
| 805 | echo -n "Creating HLFS <${MODEL}> specific URLs file"
|
---|
| 806 | xsltproc --nonet --xinclude \
|
---|
| 807 | --stringparam server $SERVER \
|
---|
| 808 | --stringparam model $MODEL \
|
---|
| 809 | -o $BUILDDIR/sources/urls.lst urls.xsl \
|
---|
| 810 | $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 811 | echo " ...OK"
|
---|
| 812 | ;;
|
---|
| 813 | lfs)
|
---|
| 814 | echo -n "Creating LFS specific URLs file"
|
---|
| 815 | xsltproc --nonet --xinclude \
|
---|
| 816 | --stringparam server $SERVER \
|
---|
| 817 | -o ../sources/urls.lst urls.xsl \
|
---|
| 818 | $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 819 | echo " ...OK"
|
---|
| 820 | ;;
|
---|
| 821 | esac
|
---|
[877cc6a] | 822 |
|
---|
[15cad16] | 823 | cd $BUILDDIR/sources
|
---|
[4965fa8] | 824 |
|
---|
[05d1b17] | 825 | if [[ "${BLFS_TOOL}" = "y" ]]; then
|
---|
| 826 | add_blfs_deps_urls
|
---|
| 827 | fi
|
---|
[045b2dc] | 828 |
|
---|
[9a536f7] | 829 | if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
|
---|
| 830 | add_CustomToolsURLS
|
---|
| 831 | fi
|
---|
| 832 |
|
---|
[4965fa8] | 833 | }
|
---|
| 834 |
|
---|
| 835 | #----------------------------# Hardcoded URLs and MD5.
|
---|
| 836 | add_blfs_deps_urls() { # No easy way to extract it.
|
---|
| 837 | #----------------------------# Some FTP mirrors may not work
|
---|
| 838 |
|
---|
| 839 | local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
|
---|
| 840 |
|
---|
| 841 | if [[ "${DEP_LIBXML}" = "y" ]] ; then
|
---|
| 842 | echo "${LIBXML_URL} ${BLFS_SERVER}libxml2/${LIBXML_PKG} ${LIBXML_MD5}" >> urls.lst
|
---|
| 843 | fi
|
---|
| 844 |
|
---|
| 845 | if [[ "${DEP_LIBXSLT}" = "y" ]] ; then
|
---|
| 846 | echo "${LIBXSLT_URL} ${BLFS_SERVER}libxslt/${LIBXSLT_PKG} ${LIBXSLT_MD5}" >> urls.lst
|
---|
| 847 | fi
|
---|
| 848 |
|
---|
[045b2dc] | 849 | if [[ "${DEP_TIDY}" = "y" ]] ; then
|
---|
| 850 | echo "${TIDY_URL} ${BLFS_SERVER}tidy/${TIDY_PKG} ${TIDY_MD5}" >> urls.lst
|
---|
| 851 | echo "${TIDY_PATCH_URL} ${BLFS_SERVER}tidy/${TIDY_PATCH} ${TIDY_PATCH_MD5}" >> urls.lst
|
---|
[cbc8ba2] | 852 | echo "${TIDY_DOCS_URL} ${BLFS_SERVER}tidy/${TIDY_DOCS} ${TIDY_DOCS_MD5}" >> urls.lst
|
---|
[045b2dc] | 853 | fi
|
---|
| 854 |
|
---|
| 855 | if [[ "${DEP_UNZIP}" = "y" ]] ; then
|
---|
| 856 | echo "${UNZIP_URL} ${BLFS_SERVER}unzip/${UNZIP_PKG} ${UNZIP_MD5}" >> urls.lst
|
---|
| 857 | fi
|
---|
| 858 |
|
---|
| 859 | if [[ "${DEP_DBXML}" = "y" ]] ; then
|
---|
| 860 | echo "${DBXML_URL} ${BLFS_SERVER}docbook-xml/${DBXML_PKG} ${DBXML_MD5}" >> urls.lst
|
---|
| 861 | fi
|
---|
| 862 |
|
---|
[4965fa8] | 863 | if [[ "${DEP_DBXSL}" = "y" ]] ; then
|
---|
| 864 | echo "${DBXSL_URL} ${BLFS_SERVER}docbook-xsl/${DBXSL_PKG} ${DBXSL_MD5}" >> urls.lst
|
---|
| 865 | fi
|
---|
| 866 |
|
---|
| 867 | if [[ "${DEP_LINKS}" = "y" ]] ; then
|
---|
| 868 | echo "${LINKS_URL} ${BLFS_SERVER}links/${LINKS_PKG} ${LINKS_MD5}" >> urls.lst
|
---|
| 869 | fi
|
---|
| 870 |
|
---|
| 871 | if [[ "${DEP_SUDO}" = "y" ]] ; then
|
---|
| 872 | echo "${SUDO_URL} ${BLFS_SERVER}sudo/${SUDO_PKG} ${SUDO_MD5}" >> urls.lst
|
---|
| 873 | echo "${SUDO_PATCH_URL} ${BLFS_SERVER}sudo/${SUDO_PATCH} ${SUDO_PATCH_MD5}" >> urls.lst
|
---|
| 874 | fi
|
---|
| 875 |
|
---|
| 876 | if [[ "${DEP_WGET}" = "y" ]] ; then
|
---|
| 877 | echo "${WGET_URL} ${BLFS_SERVER}wget/${WGET_PKG} ${WGET_MD5}" >> urls.lst
|
---|
| 878 | fi
|
---|
| 879 |
|
---|
| 880 | if [[ "${DEP_SVN}" = "y" ]] ; then
|
---|
| 881 | echo "${SVN_URL} ${BLFS_SERVER}subversion/${SVN_PKG} ${SVN_MD5}" >> urls.lst
|
---|
| 882 | fi
|
---|
| 883 |
|
---|
| 884 | if [[ "${DEP_GPM}" = "y" ]] ; then
|
---|
| 885 | echo "${GPM_URL} ${BLFS_SERVER}gpm/${GPM_PKG} ${GPM_MD5}" >> urls.lst
|
---|
| 886 | echo "${GPM_PATCH_1_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_1} ${GPM_PATCH_1_MD5}" >> urls.lst
|
---|
| 887 | echo "${GPM_PATCH_2_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_2} ${GPM_PATCH_2_MD5}" >> urls.lst
|
---|
| 888 | fi
|
---|
| 889 |
|
---|
| 890 | }
|
---|
| 891 |
|
---|
| 892 | #----------------------------# Maybe there is a better way to do this, but this
|
---|
| 893 | copy_blfs_deps_scripts() { # method avoid to place the test on all
|
---|
| 894 | #----------------------------# $PROGNAME/master.sh scripts.
|
---|
| 895 |
|
---|
| 896 | mkdir -p ${PROGNAME}-commands/blfs-tool-deps
|
---|
| 897 |
|
---|
| 898 | if [[ "${DEP_LIBXML}" = "y" ]] ; then
|
---|
| 899 | mv blfs-tool-deps/901-libxml2 ${PROGNAME}-commands/blfs-tool-deps
|
---|
| 900 | fi
|
---|
| 901 |
|
---|
| 902 | if [[ "${DEP_LIBXSLT}" = "y" ]] ; then
|
---|
| 903 | mv blfs-tool-deps/902-libxslt ${PROGNAME}-commands/blfs-tool-deps
|
---|
| 904 | fi
|
---|
| 905 |
|
---|
[045b2dc] | 906 | if [[ "${DEP_TIDY}" = "y" ]] ; then
|
---|
| 907 | mv blfs-tool-deps/903-tidy ${PROGNAME}-commands/blfs-tool-deps
|
---|
| 908 | fi
|
---|
| 909 |
|
---|
| 910 | if [[ "${DEP_UNZIP}" = "y" ]] ; then
|
---|
| 911 | mv blfs-tool-deps/904-unzip ${PROGNAME}-commands/blfs-tool-deps
|
---|
| 912 | fi
|
---|
| 913 |
|
---|
| 914 | if [[ "${DEP_DBXML}" = "y" ]] ; then
|
---|
| 915 | mv blfs-tool-deps/905-docbook-xml ${PROGNAME}-commands/blfs-tool-deps
|
---|
| 916 | fi
|
---|
| 917 |
|
---|
[4965fa8] | 918 | if [[ "${DEP_DBXSL}" = "y" ]] ; then
|
---|
[045b2dc] | 919 | mv blfs-tool-deps/906-docbook-xsl ${PROGNAME}-commands/blfs-tool-deps
|
---|
[4965fa8] | 920 | fi
|
---|
| 921 |
|
---|
| 922 | if [[ "${DEP_LINKS}" = "y" ]] ; then
|
---|
[045b2dc] | 923 | mv blfs-tool-deps/908-links ${PROGNAME}-commands/blfs-tool-deps
|
---|
[4965fa8] | 924 | fi
|
---|
| 925 |
|
---|
| 926 | if [[ "${DEP_SUDO}" = "y" ]] ; then
|
---|
[045b2dc] | 927 | mv blfs-tool-deps/909-sudo ${PROGNAME}-commands/blfs-tool-deps
|
---|
[4965fa8] | 928 | fi
|
---|
| 929 |
|
---|
| 930 | if [[ "${DEP_WGET}" = "y" ]] ; then
|
---|
[045b2dc] | 931 | mv blfs-tool-deps/910-wget ${PROGNAME}-commands/blfs-tool-deps
|
---|
[4965fa8] | 932 | fi
|
---|
| 933 |
|
---|
| 934 | if [[ "${DEP_SVN}" = "y" ]] ; then
|
---|
[045b2dc] | 935 | mv blfs-tool-deps/911-subversion ${PROGNAME}-commands/blfs-tool-deps
|
---|
[4965fa8] | 936 | fi
|
---|
| 937 |
|
---|
| 938 | if [[ "${DEP_GPM}" = "y" ]] ; then
|
---|
[045b2dc] | 939 | mv blfs-tool-deps/907-gpm ${PROGNAME}-commands/blfs-tool-deps
|
---|
[4965fa8] | 940 | fi
|
---|
| 941 |
|
---|
| 942 | rm -rf blfs-tool-deps
|
---|
| 943 |
|
---|
[877cc6a] | 944 | }
|
---|