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