[877cc6a] | 1 | #!/bin/sh
|
---|
| 2 |
|
---|
| 3 | # $Id$
|
---|
| 4 |
|
---|
| 5 | ###################################
|
---|
| 6 | ### FUNCTIONS ###
|
---|
| 7 | ###################################
|
---|
| 8 |
|
---|
| 9 |
|
---|
| 10 |
|
---|
| 11 | #----------------------------#
|
---|
| 12 | chapter4_Makefiles() {
|
---|
| 13 | #----------------------------#
|
---|
| 14 | echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4${R_arrow}"
|
---|
| 15 |
|
---|
| 16 | # If /home/lfs is already present in the host, we asume that the
|
---|
| 17 | # lfs user and group are also presents in the host, and a backup
|
---|
| 18 | # of their bash init files is made.
|
---|
| 19 | (
|
---|
| 20 | cat << EOF
|
---|
| 21 | 020-creatingtoolsdir:
|
---|
| 22 | @\$(call echo_message, Building)
|
---|
[cee9568] | 23 | @mkdir \$(MOUNT_PT)/tools && \\
|
---|
| 24 | rm -f /tools && \\
|
---|
| 25 | ln -s \$(MOUNT_PT)/tools / && \\
|
---|
[877cc6a] | 26 | touch \$@
|
---|
| 27 |
|
---|
| 28 | 021-addinguser: 020-creatingtoolsdir
|
---|
| 29 | @\$(call echo_message, Building)
|
---|
| 30 | @if [ ! -d /home/lfs ]; then \\
|
---|
| 31 | groupadd lfs; \\
|
---|
| 32 | useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
|
---|
| 33 | else \\
|
---|
| 34 | touch user-lfs-exist; \\
|
---|
| 35 | fi;
|
---|
| 36 | @chown lfs \$(MOUNT_PT)/tools && \\
|
---|
| 37 | chmod a+wt \$(MOUNT_PT)/sources && \\
|
---|
| 38 | touch \$@
|
---|
| 39 |
|
---|
| 40 | 022-settingenvironment: 021-addinguser
|
---|
| 41 | @\$(call echo_message, Building)
|
---|
| 42 | @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
[cee9568] | 43 | mv /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
|
---|
[877cc6a] | 44 | fi;
|
---|
| 45 | @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
[cee9568] | 46 | mv /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
|
---|
[877cc6a] | 47 | fi;
|
---|
| 48 | @echo "set +h" > /home/lfs/.bashrc && \\
|
---|
| 49 | echo "umask 022" >> /home/lfs/.bashrc && \\
|
---|
[5a13801] | 50 | echo "LFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\
|
---|
[877cc6a] | 51 | echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
|
---|
| 52 | echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
|
---|
| 53 | echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
|
---|
| 54 | echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\
|
---|
| 55 | chown lfs:lfs /home/lfs/.bashrc && \\
|
---|
| 56 | touch envars && \\
|
---|
| 57 | touch \$@
|
---|
| 58 | EOF
|
---|
| 59 | ) >> $MKFILE.tmp
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | #----------------------------#
|
---|
| 63 | chapter5_Makefiles() {
|
---|
| 64 | #----------------------------#
|
---|
| 65 | echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5${R_arrow}"
|
---|
| 66 |
|
---|
| 67 | for file in chapter05/* ; do
|
---|
| 68 | # Keep the script file name
|
---|
| 69 | this_script=`basename $file`
|
---|
| 70 |
|
---|
| 71 | # If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed
|
---|
[a241c33] | 72 | # Fix also locales creation when running chapter05 testsuites (ugly)
|
---|
[877cc6a] | 73 | case "${this_script}" in
|
---|
| 74 | *tcl) [[ "${TEST}" = "0" ]] && continue ;;
|
---|
| 75 | *expect) [[ "${TEST}" = "0" ]] && continue ;;
|
---|
| 76 | *dejagnu) [[ "${TEST}" = "0" ]] && continue ;;
|
---|
| 77 | *stripping) [[ "${STRIP}" = "0" ]] && continue ;;
|
---|
[a241c33] | 78 | *glibc) [[ "${TEST}" = "3" ]] && \
|
---|
[d46a46e] | 79 | sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;;
|
---|
[877cc6a] | 80 | esac
|
---|
| 81 |
|
---|
| 82 | # First append each name of the script files to a list (this will become
|
---|
| 83 | # the names of the targets in the Makefile
|
---|
| 84 | chapter5="$chapter5 ${this_script}"
|
---|
| 85 |
|
---|
| 86 | # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
|
---|
| 87 | # and binutils in chapter 5)
|
---|
| 88 | name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
|
---|
| 89 |
|
---|
| 90 | # Set the dependency for the first target.
|
---|
| 91 | if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
|
---|
| 92 |
|
---|
| 93 | #--------------------------------------------------------------------#
|
---|
| 94 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 95 | #--------------------------------------------------------------------#
|
---|
| 96 | #
|
---|
| 97 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 98 | # as a dependency. Also call the echo_message function.
|
---|
| 99 | wrt_target "${this_script}" "$PREV"
|
---|
| 100 |
|
---|
| 101 | # Find the version of the command files, if it corresponds with the building of
|
---|
| 102 | # a specific package
|
---|
| 103 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 104 |
|
---|
| 105 | # If $vrs isn't empty, we've got a package...
|
---|
| 106 | if [ "$vrs" != "" ] ; then
|
---|
| 107 | if [ "$name" = "tcl" ] ; then
|
---|
| 108 | FILE="$name$vrs-src.tar.*"
|
---|
| 109 | else
|
---|
| 110 | FILE="$name-$vrs.tar.*"
|
---|
| 111 | fi
|
---|
[b7faa5a] | 112 |
|
---|
[877cc6a] | 113 | # Insert instructions for unpacking the package and to set the PKGDIR variable.
|
---|
| 114 | wrt_unpack "$FILE"
|
---|
[a229600] | 115 | # If the testsuites must be run, initialize the log file
|
---|
| 116 | [[ "$TEST" = "3" ]] && wrt_test_log "${this_script}"
|
---|
| 117 | # If using optimizations, write the instructions
|
---|
[1b65a84] | 118 | [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
[877cc6a] | 119 | fi
|
---|
| 120 |
|
---|
| 121 | # Insert date and disk usage at the top of the log file, the script run
|
---|
| 122 | # and date and disk usage again at the bottom of the log file.
|
---|
[a241c33] | 123 | # The changingowner script must be run as root.
|
---|
| 124 | case "${this_script}" in
|
---|
| 125 | *changingowner) wrt_run_as_root "${this_script}" "$file" ;;
|
---|
| 126 | *) wrt_run_as_su "${this_script}" "$file" ;;
|
---|
| 127 | esac
|
---|
[877cc6a] | 128 |
|
---|
| 129 | # Remove the build directory(ies) except if the package build fails
|
---|
| 130 | # (so we can review config.cache, config.log, etc.)
|
---|
| 131 | if [ "$vrs" != "" ] ; then
|
---|
| 132 | wrt_remove_build_dirs "$name"
|
---|
| 133 | fi
|
---|
| 134 |
|
---|
| 135 | # Include a touch of the target name so make can check
|
---|
| 136 | # if it's already been made.
|
---|
| 137 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 138 | #
|
---|
| 139 | #--------------------------------------------------------------------#
|
---|
| 140 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 141 | #--------------------------------------------------------------------#
|
---|
| 142 |
|
---|
| 143 | # Keep the script file name for Makefile dependencies.
|
---|
| 144 | PREV=${this_script}
|
---|
| 145 | done # end for file in chapter05/*
|
---|
| 146 | }
|
---|
| 147 |
|
---|
| 148 | #----------------------------#
|
---|
| 149 | chapter6_Makefiles() {
|
---|
| 150 | #----------------------------#
|
---|
[45f82718] | 151 | # Set envars and scripts for iteration targets
|
---|
| 152 | LOGS="" # Start with an empty global LOGS envar
|
---|
| 153 | if [[ -z "$1" ]] ; then
|
---|
| 154 | local N=""
|
---|
| 155 | else
|
---|
| 156 | local N=-build_$1
|
---|
| 157 | local chapter6=""
|
---|
| 158 | mkdir chapter06$N
|
---|
| 159 | cp chapter06/* chapter06$N
|
---|
| 160 | for script in chapter06$N/* ; do
|
---|
| 161 | # Overwrite existing symlinks, files, and dirs
|
---|
| 162 | sed -e 's/ln -sv/&f/g' \
|
---|
| 163 | -e 's/mv -v/&f/g' \
|
---|
| 164 | -e 's/mkdir -v/&p/g' -i ${script}
|
---|
| 165 | done
|
---|
| 166 | # Remove Bzip2 binaries before make install
|
---|
| 167 | sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2
|
---|
| 168 | # Let some Udev pre-installation commands to fail
|
---|
| 169 | sed -e 's@/lib/udev/devices/fd@& || true@' \
|
---|
| 170 | -e 's/mknod -m.*/& || true/' -i chapter06$N/*-udev
|
---|
| 171 | fi
|
---|
| 172 |
|
---|
| 173 | echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N${R_arrow}"
|
---|
| 174 |
|
---|
| 175 | for file in chapter06$N/* ; do
|
---|
[877cc6a] | 176 | # Keep the script file name
|
---|
| 177 | this_script=`basename $file`
|
---|
| 178 |
|
---|
| 179 | # We'll run the chroot commands differently than the others, so skip them in the
|
---|
| 180 | # dependencies and target creation.
|
---|
| 181 | case "${this_script}" in
|
---|
| 182 | *chroot) continue ;;
|
---|
| 183 | *stripping*) [[ "${STRIP}" = "0" ]] && continue ;;
|
---|
| 184 | esac
|
---|
| 185 |
|
---|
| 186 | # Grab the name of the target
|
---|
| 187 | name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@'`
|
---|
| 188 |
|
---|
[45f82718] | 189 | # Find the version of the command files, if it corresponds with the building of
|
---|
| 190 | # a specific package. We need this here to can skip scripts not needed for
|
---|
| 191 | # iterations rebuilds
|
---|
| 192 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 193 |
|
---|
| 194 | if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
|
---|
| 195 | case "${this_script}" in
|
---|
| 196 | *stripping*) ;;
|
---|
| 197 | *) continue ;;
|
---|
| 198 | esac
|
---|
| 199 | fi
|
---|
| 200 |
|
---|
| 201 | # Append each name of the script files to a list (this will become
|
---|
| 202 | # the names of the targets in the Makefile)
|
---|
| 203 | chapter6="$chapter6 ${this_script}${N}"
|
---|
| 204 |
|
---|
| 205 | # Append each name of the script files to a list (this will become
|
---|
| 206 | # the names of the logs to be moved for each iteration)
|
---|
| 207 | LOGS="$LOGS ${this_script}"
|
---|
| 208 |
|
---|
[877cc6a] | 209 | #--------------------------------------------------------------------#
|
---|
| 210 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 211 | #--------------------------------------------------------------------#
|
---|
| 212 | #
|
---|
| 213 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 214 | # as a dependency. Also call the echo_message function.
|
---|
[45f82718] | 215 | wrt_target "${this_script}${N}" "$PREV"
|
---|
[877cc6a] | 216 |
|
---|
| 217 | # If $vrs isn't empty, we've got a package...
|
---|
| 218 | # Insert instructions for unpacking the package and changing directories
|
---|
| 219 | if [ "$vrs" != "" ] ; then
|
---|
| 220 | FILE="$name-$vrs.tar.*"
|
---|
| 221 | wrt_unpack2 "$FILE"
|
---|
[a229600] | 222 | # If the testsuites must be run, initialize the log file
|
---|
| 223 | case $name in
|
---|
| 224 | binutils | gcc | glibc )
|
---|
| 225 | [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
|
---|
| 226 | ;;
|
---|
| 227 | * )
|
---|
| 228 | [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && wrt_test_log2 "${this_script}"
|
---|
| 229 | ;;
|
---|
| 230 | esac
|
---|
| 231 | # If using optimizations, write the instructions
|
---|
[1b65a84] | 232 | [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
[877cc6a] | 233 | fi
|
---|
| 234 |
|
---|
| 235 | # In the mount of kernel filesystems we need to set LFS
|
---|
| 236 | # and not to use chroot.
|
---|
| 237 | case "${this_script}" in
|
---|
| 238 | *kernfs) wrt_run_as_root "${this_script}" "$file" ;;
|
---|
| 239 | *) wrt_run_as_chroot1 "${this_script}" "$file" ;;
|
---|
| 240 | esac
|
---|
| 241 |
|
---|
| 242 | # Remove the build directory(ies) except if the package build fails.
|
---|
| 243 | if [ "$vrs" != "" ] ; then
|
---|
| 244 | wrt_remove_build_dirs "$name"
|
---|
| 245 | fi
|
---|
| 246 |
|
---|
| 247 | # Include a touch of the target name so make can check
|
---|
| 248 | # if it's already been made.
|
---|
| 249 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 250 | #
|
---|
| 251 | #--------------------------------------------------------------------#
|
---|
| 252 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 253 | #--------------------------------------------------------------------#
|
---|
| 254 |
|
---|
| 255 | # Keep the script file name for Makefile dependencies.
|
---|
[45f82718] | 256 | PREV=${this_script}${N}
|
---|
| 257 | # Set system_build envar for iteration targets
|
---|
| 258 | system_build=$chapter6
|
---|
[877cc6a] | 259 | done # end for file in chapter06/*
|
---|
| 260 | }
|
---|
| 261 |
|
---|
| 262 | #----------------------------#
|
---|
| 263 | chapter789_Makefiles() {
|
---|
| 264 | #----------------------------#
|
---|
| 265 | echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8/9${R_arrow}"
|
---|
| 266 |
|
---|
| 267 | for file in chapter0{7,8,9}/* ; do
|
---|
| 268 | # Keep the script file name
|
---|
| 269 | this_script=`basename $file`
|
---|
| 270 |
|
---|
| 271 | # Grub must be configured manually.
|
---|
| 272 | # The filesystems can't be unmounted via Makefile and the user
|
---|
| 273 | # should enter the chroot environment to create the root
|
---|
| 274 | # password, edit several files and setup Grub.
|
---|
| 275 | #
|
---|
| 276 | # If no .config file is supplied, the kernel build is skipped
|
---|
| 277 | #
|
---|
| 278 | case ${this_script} in
|
---|
| 279 | *grub) continue ;;
|
---|
| 280 | *reboot) continue ;;
|
---|
| 281 | *console) continue ;; # Use the file generated by lfs-bootscripts
|
---|
| 282 | *kernel) [[ -z ${CONFIG} ]] && continue
|
---|
| 283 | cp ${CONFIG} $BUILDDIR/sources/kernel-config ;;
|
---|
| 284 | esac
|
---|
| 285 |
|
---|
| 286 | # First append each name of the script files to a list (this will become
|
---|
| 287 | # the names of the targets in the Makefile
|
---|
| 288 | chapter789="$chapter789 ${this_script}"
|
---|
| 289 |
|
---|
| 290 | #--------------------------------------------------------------------#
|
---|
| 291 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 292 | #--------------------------------------------------------------------#
|
---|
| 293 | #
|
---|
| 294 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 295 | # as a dependency. Also call the echo_message function.
|
---|
| 296 | wrt_target "${this_script}" "$PREV"
|
---|
| 297 |
|
---|
| 298 | # Find the bootscripts and kernel package names
|
---|
| 299 | case "${this_script}" in
|
---|
| 300 | *bootscripts)
|
---|
| 301 | vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 302 | FILE="lfs-bootscripts-$vrs.tar.*"
|
---|
| 303 | wrt_unpack2 "$FILE"
|
---|
| 304 | ;;
|
---|
| 305 | *kernel)
|
---|
| 306 | vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 307 | FILE="linux-$vrs.tar.*"
|
---|
| 308 | wrt_unpack2 "$FILE"
|
---|
| 309 | ;;
|
---|
| 310 | esac
|
---|
| 311 |
|
---|
| 312 | # Check if we have a real /etc/fstab file
|
---|
| 313 | case "${this_script}" in
|
---|
| 314 | *fstab) if [[ -n $FSTAB ]]; then
|
---|
| 315 | wrt_copy_fstab "${this_script}"
|
---|
| 316 | else
|
---|
| 317 | wrt_run_as_chroot2 "$this_script" "$file"
|
---|
| 318 | fi
|
---|
| 319 | ;;
|
---|
| 320 | *) wrt_run_as_chroot2 "$this_script" "$file"
|
---|
| 321 | ;;
|
---|
| 322 | esac
|
---|
| 323 |
|
---|
| 324 | case "${this_script}" in
|
---|
| 325 | *bootscripts) wrt_remove_build_dirs "dummy" ;;
|
---|
| 326 | *kernel) wrt_remove_build_dirs "dummy" ;;
|
---|
| 327 | esac
|
---|
| 328 |
|
---|
| 329 | # Include a touch of the target name so make can check
|
---|
| 330 | # if it's already been made.
|
---|
| 331 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 332 | #
|
---|
| 333 | #--------------------------------------------------------------------#
|
---|
| 334 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 335 | #--------------------------------------------------------------------#
|
---|
| 336 |
|
---|
| 337 | # Keep the script file name for Makefile dependencies.
|
---|
| 338 | PREV=${this_script}
|
---|
| 339 | done # for file in chapter0{7,8,9}/*
|
---|
[453bef0] | 340 |
|
---|
| 341 | # Add SBU-disk_usage report target if required
|
---|
| 342 | if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
|
---|
[877cc6a] | 343 | }
|
---|
| 344 |
|
---|
| 345 |
|
---|
| 346 | #----------------------------#
|
---|
| 347 | build_Makefile() {
|
---|
| 348 | #----------------------------#
|
---|
[c7c5a53] | 349 | echo "Creating Makefile... ${BOLD}START${OFF}"
|
---|
[877cc6a] | 350 | cd $JHALFSDIR/${PROGNAME}-commands
|
---|
| 351 |
|
---|
| 352 | # Start with a clean Makefile.tmp file
|
---|
| 353 | >$MKFILE.tmp
|
---|
| 354 |
|
---|
| 355 | chapter4_Makefiles
|
---|
| 356 | chapter5_Makefiles
|
---|
| 357 | chapter6_Makefiles
|
---|
[45f82718] | 358 | # Add the iterations targets, if needed
|
---|
| 359 | [[ "$COMPARE" != "0" ]] && wrt_compare_targets
|
---|
[877cc6a] | 360 | chapter789_Makefiles
|
---|
| 361 |
|
---|
| 362 |
|
---|
| 363 | # Add a header, some variables and include the function file
|
---|
| 364 | # to the top of the real Makefile.
|
---|
| 365 | (
|
---|
| 366 | cat << EOF
|
---|
| 367 | $HEADER
|
---|
| 368 |
|
---|
| 369 | SRC= /sources
|
---|
| 370 | MOUNT_PT= $BUILDDIR
|
---|
[82eb8c1] | 371 | PKG_LST= $PKG_LST
|
---|
[877cc6a] | 372 |
|
---|
| 373 | include makefile-functions
|
---|
| 374 |
|
---|
| 375 | EOF
|
---|
| 376 | ) > $MKFILE
|
---|
| 377 |
|
---|
| 378 |
|
---|
| 379 | # Add chroot commands
|
---|
| 380 | i=1
|
---|
| 381 | for file in chapter06/*chroot* ; do
|
---|
| 382 | chroot=`cat $file | sed -e '/#!\/bin\/sh/d' -e 's@ \\\@ @g' | tr -d '\n' | sed \
|
---|
| 383 | -e 's/ */ /g' -e 's|\\$|&&|g' -e 's|exit||g' -e 's|$| -c|' \
|
---|
| 384 | -e 's|"$$LFS"|$(MOUNT_PT)|' -e 's|set -e||'`
|
---|
| 385 | echo -e "CHROOT$i= $chroot\n" >> $MKFILE
|
---|
| 386 | i=`expr $i + 1`
|
---|
| 387 | done
|
---|
| 388 |
|
---|
| 389 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
| 390 | # as a dependency.
|
---|
| 391 | (
|
---|
| 392 | cat << EOF
|
---|
[7d9a82d] | 393 | all: chapter4 chapter5 chapter6 chapter789 do_housekeeping
|
---|
[877cc6a] | 394 | @\$(call echo_finished,$VERSION)
|
---|
| 395 |
|
---|
| 396 | chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
|
---|
| 397 |
|
---|
| 398 | chapter5: chapter4 $chapter5 restore-lfs-env
|
---|
| 399 |
|
---|
| 400 | chapter6: chapter5 $chapter6
|
---|
| 401 |
|
---|
| 402 | chapter789: chapter6 $chapter789
|
---|
| 403 |
|
---|
| 404 | clean-all: clean
|
---|
| 405 | rm -rf ./{lfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
|
---|
| 406 |
|
---|
| 407 | clean: clean-chapter789 clean-chapter6 clean-chapter5 clean-chapter4
|
---|
| 408 |
|
---|
[fe24ca6] | 409 | restart: restart_code all
|
---|
| 410 |
|
---|
[877cc6a] | 411 | clean-chapter4:
|
---|
| 412 | -if [ ! -f user-lfs-exist ]; then \\
|
---|
| 413 | userdel lfs; \\
|
---|
| 414 | rm -rf /home/lfs; \\
|
---|
| 415 | fi;
|
---|
| 416 | rm -rf \$(MOUNT_PT)/tools
|
---|
| 417 | rm -f /tools
|
---|
| 418 | rm -f envars user-lfs-exist
|
---|
| 419 | rm -f 02* logs/02*.log
|
---|
| 420 |
|
---|
| 421 | clean-chapter5:
|
---|
| 422 | rm -rf \$(MOUNT_PT)/tools/*
|
---|
| 423 | rm -f $chapter5 restore-lfs-env sources-dir
|
---|
| 424 | cd logs && rm -f $chapter5 && cd ..
|
---|
| 425 |
|
---|
| 426 | clean-chapter6:
|
---|
| 427 | -umount \$(MOUNT_PT)/sys
|
---|
| 428 | -umount \$(MOUNT_PT)/proc
|
---|
| 429 | -umount \$(MOUNT_PT)/dev/shm
|
---|
| 430 | -umount \$(MOUNT_PT)/dev/pts
|
---|
| 431 | -umount \$(MOUNT_PT)/dev
|
---|
| 432 | rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
---|
| 433 | rm -f $chapter6
|
---|
| 434 | cd logs && rm -f $chapter6 && cd ..
|
---|
| 435 |
|
---|
| 436 | clean-chapter789:
|
---|
| 437 | rm -f $chapter789
|
---|
| 438 | cd logs && rm -f $chapter789 && cd ..
|
---|
| 439 |
|
---|
| 440 | restore-lfs-env:
|
---|
| 441 | @\$(call echo_message, Building)
|
---|
| 442 | @if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
[cee9568] | 443 | mv -f /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
---|
[877cc6a] | 444 | fi;
|
---|
| 445 | @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
[e314f7e] | 446 | mv /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
---|
[877cc6a] | 447 | fi;
|
---|
| 448 | @chown lfs:lfs /home/lfs/.bash* && \\
|
---|
| 449 | touch \$@
|
---|
[a858a78] | 450 |
|
---|
[7d9a82d] | 451 | do_housekeeping:
|
---|
| 452 | -umount \$(MOUNT_PT)/sys
|
---|
| 453 | -umount \$(MOUNT_PT)/proc
|
---|
| 454 | -umount \$(MOUNT_PT)/dev/shm
|
---|
| 455 | -umount \$(MOUNT_PT)/dev/pts
|
---|
| 456 | -umount \$(MOUNT_PT)/dev
|
---|
| 457 | -if [ ! -f user-lfs-exist ]; then \\
|
---|
| 458 | userdel lfs; \\
|
---|
| 459 | rm -rf /home/lfs; \\
|
---|
| 460 | fi;
|
---|
[a858a78] | 461 |
|
---|
[fe24ca6] | 462 | restart_code:
|
---|
| 463 | @echo "This feature is experimental, BUGS may exist"
|
---|
| 464 | @if ! stat -c %N /tools | grep "\$(MOUNT_PT)/tools" >/dev/null ; then \\
|
---|
| 465 | echo -e "\\nERROR::\\nThe symlink \\"/tools\\" does not point to \\"\$(MOUNT_PT)/tools\\".\\nCorrect the problem and rerun\\n" && false;\\
|
---|
| 466 | fi;
|
---|
| 467 | @if [ -f ???-kernfs ]; then \\
|
---|
| 468 | mkdir -pv \$(MOUNT_PT)/{dev,proc,sys};\\
|
---|
| 469 | if [ ! -e \$(MOUNT_PT)/dev/console ]; then \\
|
---|
| 470 | mknod -m 600 \$(MOUNT_PT)/dev/console c 5 1;\\
|
---|
| 471 | fi;\\
|
---|
| 472 | if [ ! -e \$(MOUNT_PT)/dev/null ]; then \\
|
---|
| 473 | mknod -m 666 \$(MOUNT_PT)/dev/null c 1 3;\\
|
---|
| 474 | fi;\\
|
---|
| 475 | if ! mount -l | grep bind >/dev/null ; then \\
|
---|
| 476 | mount --bind /dev \$(MOUNT_PT)/dev;\\
|
---|
| 477 | fi;\\
|
---|
| 478 | if ! mount -l | grep "\$(MOUNT_PT)/dev/pts" >/dev/null ; then \\
|
---|
| 479 | mount -vt devpts devpts \$(MOUNT_PT)/dev/pts;\\
|
---|
| 480 | fi;\\
|
---|
| 481 | if ! mount -l | grep "\$(MOUNT_PT)/dev/shm" >/dev/null ; then \\
|
---|
| 482 | mount -vt tmpfs shm \$(MOUNT_PT)/dev/shm;\\
|
---|
| 483 | fi;\\
|
---|
| 484 | if ! mount -l | grep "\$(MOUNT_PT)/proc" >/dev/null ; then \\
|
---|
| 485 | mount -vt proc proc \$(MOUNT_PT)/proc;\\
|
---|
| 486 | fi;\\
|
---|
| 487 | if ! mount -l | grep "$\(MOUNT_PT)/sys" >/dev/null ; then \\
|
---|
| 488 | mount -vt sysfs sysfs \$(MOUNT_PT)/sys;\\
|
---|
| 489 | fi;\\
|
---|
[e314f7e] | 490 | fi;
|
---|
[fe24ca6] | 491 |
|
---|
[877cc6a] | 492 | EOF
|
---|
| 493 | ) >> $MKFILE
|
---|
| 494 |
|
---|
| 495 | # Bring over the items from the Makefile.tmp
|
---|
| 496 | cat $MKFILE.tmp >> $MKFILE
|
---|
| 497 | rm $MKFILE.tmp
|
---|
[c7c5a53] | 498 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
[877cc6a] | 499 |
|
---|
[c7c5a53] | 500 | }
|
---|
[877cc6a] | 501 |
|
---|