[9c9775f] | 1 | #!/bin/bash
|
---|
[0170229] | 2 |
|
---|
[a46ada0] | 3 | # $Id$
|
---|
[0170229] | 4 |
|
---|
| 5 | ###################################
|
---|
| 6 | ### FUNCTIONS ###
|
---|
| 7 | ###################################
|
---|
| 8 |
|
---|
| 9 |
|
---|
[50fb011] | 10 | #############################################################
|
---|
| 11 |
|
---|
| 12 |
|
---|
[0170229] | 13 | #----------------------------#
|
---|
[50fb011] | 14 | chapter4_Makefiles() { #
|
---|
[0170229] | 15 | #----------------------------#
|
---|
[50fb011] | 16 | echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4 ( SETUP ) ${R_arrow}"
|
---|
[0170229] | 17 |
|
---|
[9c9775f] | 18 | # If $LUSER_HOME is already present in the host, we asume that the
|
---|
[0170229] | 19 | # lfs user and group are also presents in the host, and a backup
|
---|
| 20 | # of their bash init files is made.
|
---|
| 21 | (
|
---|
| 22 | cat << EOF
|
---|
[3b6adab] | 23 | 04_02-creatingtoolsdir:
|
---|
[0170229] | 24 | @\$(call echo_message, Building)
|
---|
[9199a13] | 25 | @mkdir \$(MOUNT_PT)/tools && \\
|
---|
| 26 | rm -f /tools && \\
|
---|
[9c9775f] | 27 | ln -s \$(MOUNT_PT)/tools /
|
---|
| 28 | @\$(call housekeeping)
|
---|
[0170229] | 29 |
|
---|
[c5ae20a] | 30 | 04_03-addinguser: 04_02-creatingtoolsdir
|
---|
[0170229] | 31 | @\$(call echo_message, Building)
|
---|
[9c9775f] | 32 | @if [ ! -d \$(LUSER_HOME) ]; then \\
|
---|
[9485eba] | 33 | groupadd \$(LGROUP); \\
|
---|
| 34 | useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
---|
[0170229] | 35 | else \\
|
---|
[30737ea8] | 36 | touch luser-exist; \\
|
---|
[0170229] | 37 | fi;
|
---|
[9485eba] | 38 | @chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
---|
[9c9775f] | 39 | chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
|
---|
| 40 | chmod a+wt \$(SRCSDIR)
|
---|
| 41 | @\$(call housekeeping)
|
---|
[0170229] | 42 |
|
---|
[c5ae20a] | 43 | 04_04-settingenvironment: 04_03-addinguser
|
---|
[0170229] | 44 | @\$(call echo_message, Building)
|
---|
[9c9775f] | 45 | @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
---|
| 46 | mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
|
---|
[0170229] | 47 | fi;
|
---|
[9c9775f] | 48 | @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
---|
| 49 | mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
|
---|
[0170229] | 50 | fi;
|
---|
[9c9775f] | 51 | @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
|
---|
| 52 | echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
| 53 | echo "LFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
| 54 | echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
| 55 | echo "PATH=/tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
| 56 | echo "export LFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
| 57 | echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
[f5f857d] | 58 | chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc
|
---|
[9c9775f] | 59 | @\$(call housekeeping)
|
---|
[0170229] | 60 | EOF
|
---|
[50fb011] | 61 | ) > $MKFILE.tmp
|
---|
| 62 |
|
---|
[3b6adab] | 63 | chapter4=" 04_02-creatingtoolsdir 04_03-addinguser 04_04-settingenvironment"
|
---|
[0170229] | 64 | }
|
---|
| 65 |
|
---|
[50fb011] | 66 |
|
---|
| 67 |
|
---|
[0170229] | 68 | #----------------------------#
|
---|
| 69 | chapter5_Makefiles() {
|
---|
| 70 | #----------------------------#
|
---|
[50fb011] | 71 | echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5 ( LUSER ) ${R_arrow}"
|
---|
[12a5707] | 72 |
|
---|
[0170229] | 73 | for file in chapter05/* ; do
|
---|
| 74 | # Keep the script file name
|
---|
| 75 | this_script=`basename $file`
|
---|
| 76 |
|
---|
| 77 | # If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed
|
---|
[af4c7b1] | 78 | case "${this_script}" in
|
---|
| 79 | *tcl) [[ "${TEST}" = "0" ]] && continue ;;
|
---|
| 80 | *expect) [[ "${TEST}" = "0" ]] && continue ;;
|
---|
| 81 | *dejagnu) [[ "${TEST}" = "0" ]] && continue ;;
|
---|
[47fddc8] | 82 | *stripping) [[ "${STRIP}" = "n" ]] && continue ;;
|
---|
[af4c7b1] | 83 | esac
|
---|
[6b1576a] | 84 |
|
---|
[0170229] | 85 | # First append each name of the script files to a list (this will become
|
---|
| 86 | # the names of the targets in the Makefile
|
---|
[9c9775f] | 87 | # DO NOT append the changingowner script, it need be run as root.
|
---|
[50fb011] | 88 | # A hack is necessary: create script in chap5 BUT run as a dependency for
|
---|
[9c9775f] | 89 | # SUDO target
|
---|
[50fb011] | 90 | case "${this_script}" in
|
---|
[9c9775f] | 91 | *changingowner) runasroot="$runasroot ${this_script}" ;;
|
---|
[50fb011] | 92 | *) chapter5="$chapter5 ${this_script}" ;;
|
---|
| 93 | esac
|
---|
[0170229] | 94 |
|
---|
| 95 | # Set the dependency for the first target.
|
---|
[3b6adab] | 96 | if [ -z $PREV ] ; then PREV=04_04-settingenvironment ; fi
|
---|
[0170229] | 97 |
|
---|
[3f858ca] | 98 | #--------------------------------------------------------------------#
|
---|
| 99 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 100 | #--------------------------------------------------------------------#
|
---|
| 101 | #
|
---|
[0170229] | 102 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 103 | # as a dependency. Also call the echo_message function.
|
---|
[50fb011] | 104 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
[0170229] | 105 |
|
---|
[3b6adab] | 106 | # Run the script.
|
---|
[fed9756] | 107 | # The changingowner script must be run as root.
|
---|
| 108 | case "${this_script}" in
|
---|
[9c9775f] | 109 | *changingowner) wrt_RunAsRoot "$file" ;;
|
---|
[50fb011] | 110 | *) LUSER_wrt_RunAsUser "$file" ;;
|
---|
[fed9756] | 111 | esac
|
---|
[0170229] | 112 |
|
---|
| 113 | # Include a touch of the target name so make can check
|
---|
| 114 | # if it's already been made.
|
---|
[9199a13] | 115 | wrt_touch
|
---|
[3f858ca] | 116 | #
|
---|
| 117 | #--------------------------------------------------------------------#
|
---|
| 118 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 119 | #--------------------------------------------------------------------#
|
---|
[0170229] | 120 |
|
---|
| 121 | # Keep the script file name for Makefile dependencies.
|
---|
| 122 | PREV=${this_script}
|
---|
| 123 | done # end for file in chapter05/*
|
---|
| 124 | }
|
---|
| 125 |
|
---|
[50fb011] | 126 |
|
---|
[0170229] | 127 | #----------------------------#
|
---|
| 128 | chapter6_Makefiles() {
|
---|
| 129 | #----------------------------#
|
---|
[50fb011] | 130 |
|
---|
[615e37d] | 131 | # Set envars and scripts for iteration targets
|
---|
[b242136] | 132 | if [[ -z "$1" ]] ; then
|
---|
[aa08925] | 133 | local N=""
|
---|
| 134 | else
|
---|
| 135 | local N=-build_$1
|
---|
| 136 | local chapter6=""
|
---|
[615e37d] | 137 | mkdir chapter06$N
|
---|
| 138 | cp chapter06/* chapter06$N
|
---|
| 139 | for script in chapter06$N/* ; do
|
---|
[7aee0dd] | 140 | # Overwrite existing symlinks, files, and dirs
|
---|
[615e37d] | 141 | sed -e 's/ln -sv/&f/g' \
|
---|
| 142 | -e 's/mv -v/&f/g' \
|
---|
[7aee0dd] | 143 | -e 's/mkdir -v/&p/g' -i ${script}
|
---|
[9c9775f] | 144 | # Rename the scripts
|
---|
| 145 | mv ${script} ${script}$N
|
---|
[615e37d] | 146 | done
|
---|
[aa08925] | 147 | fi
|
---|
| 148 |
|
---|
[50fb011] | 149 | echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}"
|
---|
[af4c7b1] | 150 |
|
---|
[615e37d] | 151 | for file in chapter06$N/* ; do
|
---|
[0170229] | 152 | # Keep the script file name
|
---|
| 153 | this_script=`basename $file`
|
---|
| 154 |
|
---|
| 155 | # We'll run the chroot commands differently than the others, so skip them in the
|
---|
| 156 | # dependencies and target creation.
|
---|
[9c9775f] | 157 | # Skip also linux-headers in iterative builds.
|
---|
[af4c7b1] | 158 | case "${this_script}" in
|
---|
| 159 | *chroot) continue ;;
|
---|
[47fddc8] | 160 | *stripping*) [[ "${STRIP}" = "n" ]] && continue ;;
|
---|
[9c9775f] | 161 | *linux-headers*) [[ -n "$N" ]] && continue ;;
|
---|
[af4c7b1] | 162 | esac
|
---|
[0170229] | 163 |
|
---|
[f5f857d] | 164 | # Grab the name of the package, if any.
|
---|
[3b6adab] | 165 | name=`grep "^PACKAGE=" ${file} | sed -e 's@PACKAGE=@@'`
|
---|
[b242136] | 166 |
|
---|
[3b6adab] | 167 | # Skip scripts not needed for iterations rebuilds
|
---|
| 168 | if [[ "$name" = "" ]] && [[ -n "$N" ]] ; then
|
---|
[b242136] | 169 | case "${this_script}" in
|
---|
| 170 | *stripping*) ;;
|
---|
| 171 | *) continue ;;
|
---|
| 172 | esac
|
---|
| 173 | fi
|
---|
| 174 |
|
---|
[4edbc92] | 175 | # Append each name of the script files to a list (this will become
|
---|
| 176 | # the names of the targets in the Makefile)
|
---|
[9c9775f] | 177 | # The kernfs script must be run as part of SUDO target.
|
---|
| 178 | case "${this_script}" in
|
---|
| 179 | *kernfs) runasroot="$runasroot ${this_script}" ;;
|
---|
| 180 | *) chapter6="$chapter6 ${this_script}" ;;
|
---|
| 181 | esac
|
---|
[4edbc92] | 182 |
|
---|
[3f858ca] | 183 | #--------------------------------------------------------------------#
|
---|
| 184 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 185 | #--------------------------------------------------------------------#
|
---|
| 186 | #
|
---|
[0170229] | 187 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 188 | # as a dependency. Also call the echo_message function.
|
---|
[9c9775f] | 189 | # In the mount of kernel filesystems we need to set LFS
|
---|
| 190 | # and not to use chroot.
|
---|
| 191 | case "${this_script}" in
|
---|
| 192 | *kernfs) LUSER_wrt_target "${this_script}" "$PREV" ;;
|
---|
| 193 | *) CHROOT_wrt_target "${this_script}" "$PREV" ;;
|
---|
| 194 | esac
|
---|
[0170229] | 195 |
|
---|
[f5f857d] | 196 | # Touch timestamp file if installed files logs will be created.
|
---|
| 197 | # But only for the firt build when running iterative builds.
|
---|
| 198 | if [ "$name" != "" ] && [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
|
---|
| 199 | CHROOT_wrt_TouchTimestamp
|
---|
[0170229] | 200 | fi
|
---|
| 201 |
|
---|
| 202 | # In the mount of kernel filesystems we need to set LFS
|
---|
| 203 | # and not to use chroot.
|
---|
[af4c7b1] | 204 | case "${this_script}" in
|
---|
[9c9775f] | 205 | *kernfs) wrt_RunAsRoot "$file" ;;
|
---|
[50fb011] | 206 | *) CHROOT_wrt_RunAsRoot "$file" ;;
|
---|
[af4c7b1] | 207 | esac
|
---|
[0170229] | 208 |
|
---|
[3b6adab] | 209 | # Write installed files log
|
---|
| 210 | if [ "$name" != "" ] && [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
|
---|
| 211 | CHROOT_wrt_LogNewFiles "$name"
|
---|
[0170229] | 212 | fi
|
---|
| 213 |
|
---|
| 214 | # Include a touch of the target name so make can check
|
---|
| 215 | # if it's already been made.
|
---|
[9199a13] | 216 | wrt_touch
|
---|
[3f858ca] | 217 | #
|
---|
| 218 | #--------------------------------------------------------------------#
|
---|
| 219 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 220 | #--------------------------------------------------------------------#
|
---|
[0170229] | 221 |
|
---|
| 222 | # Keep the script file name for Makefile dependencies.
|
---|
[9c9775f] | 223 | PREV=${this_script}
|
---|
[aa08925] | 224 | # Set system_build envar for iteration targets
|
---|
| 225 | system_build=$chapter6
|
---|
[0170229] | 226 | done # end for file in chapter06/*
|
---|
| 227 | }
|
---|
| 228 |
|
---|
| 229 | #----------------------------#
|
---|
[9c9775f] | 230 | chapter78_Makefiles() {
|
---|
[0170229] | 231 | #----------------------------#
|
---|
[9c9775f] | 232 | echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8 ( BOOT ) ${R_arrow}"
|
---|
[af4c7b1] | 233 |
|
---|
[9c9775f] | 234 | for file in chapter0{7,8}/* ; do
|
---|
[0170229] | 235 | # Keep the script file name
|
---|
| 236 | this_script=`basename $file`
|
---|
| 237 |
|
---|
| 238 | # Grub must be configured manually.
|
---|
[9c9775f] | 239 | # Handle fstab creation.
|
---|
[0170229] | 240 | # If no .config file is supplied, the kernel build is skipped
|
---|
[0271c0c] | 241 | case ${this_script} in
|
---|
| 242 | *grub) continue ;;
|
---|
[50fb011] | 243 | *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
|
---|
[0271c0c] | 244 | *kernel) [[ -z ${CONFIG} ]] && continue
|
---|
| 245 | cp ${CONFIG} $BUILDDIR/sources/kernel-config ;;
|
---|
| 246 | esac
|
---|
[0170229] | 247 |
|
---|
| 248 | # First append each name of the script files to a list (this will become
|
---|
| 249 | # the names of the targets in the Makefile
|
---|
[9c9775f] | 250 | chapter78="$chapter78 ${this_script}"
|
---|
[0170229] | 251 |
|
---|
[3f858ca] | 252 | #--------------------------------------------------------------------#
|
---|
| 253 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 254 | #--------------------------------------------------------------------#
|
---|
| 255 | #
|
---|
[0170229] | 256 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 257 | # as a dependency. Also call the echo_message function.
|
---|
[50fb011] | 258 | CHROOT_wrt_target "${this_script}" "$PREV"
|
---|
[0170229] | 259 |
|
---|
[3b6adab] | 260 | # For bootscripts and kernel, start INSTALL_LOG if requested
|
---|
[af4c7b1] | 261 | case "${this_script}" in
|
---|
[3b6adab] | 262 | *bootscripts | *kernel ) if [ "${INSTALL_LOG}" = "y" ] ; then
|
---|
| 263 | CHROOT_wrt_TouchTimestamp
|
---|
| 264 | fi ;;
|
---|
[af4c7b1] | 265 | esac
|
---|
[6b1576a] | 266 |
|
---|
[0170229] | 267 | # Check if we have a real /etc/fstab file
|
---|
[af4c7b1] | 268 | case "${this_script}" in
|
---|
| 269 | *fstab) if [[ -n $FSTAB ]]; then
|
---|
[50fb011] | 270 | CHROOT_wrt_CopyFstab
|
---|
[af4c7b1] | 271 | else
|
---|
[50fb011] | 272 | CHROOT_wrt_RunAsRoot "$file"
|
---|
[af4c7b1] | 273 | fi
|
---|
| 274 | ;;
|
---|
[50fb011] | 275 | *) CHROOT_wrt_RunAsRoot "$file"
|
---|
[af4c7b1] | 276 | ;;
|
---|
| 277 | esac
|
---|
[0170229] | 278 |
|
---|
[af4c7b1] | 279 | case "${this_script}" in
|
---|
[3b6adab] | 280 | *bootscripts) if [ "${INSTALL_LOG}" = "y" ] ; then
|
---|
| 281 | CHROOT_wrt_LogNewFiles "lfs-bootscripts"
|
---|
[9c9775f] | 282 | fi ;;
|
---|
[3b6adab] | 283 | *kernel) if [ "${INSTALL_LOG}" = "y" ] ; then
|
---|
| 284 | CHROOT_wrt_LogNewFiles "linux"
|
---|
[9c9775f] | 285 | fi ;;
|
---|
[af4c7b1] | 286 | esac
|
---|
[6b1576a] | 287 |
|
---|
[0170229] | 288 | # Include a touch of the target name so make can check
|
---|
| 289 | # if it's already been made.
|
---|
[9199a13] | 290 | wrt_touch
|
---|
[3f858ca] | 291 | #
|
---|
| 292 | #--------------------------------------------------------------------#
|
---|
| 293 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 294 | #--------------------------------------------------------------------#
|
---|
[0170229] | 295 |
|
---|
| 296 | # Keep the script file name for Makefile dependencies.
|
---|
| 297 | PREV=${this_script}
|
---|
[9c9775f] | 298 | done # for file in chapter0{7,8}/*
|
---|
[9e4b9a1] | 299 |
|
---|
[0170229] | 300 | }
|
---|
| 301 |
|
---|
| 302 |
|
---|
[50fb011] | 303 |
|
---|
[0170229] | 304 | #----------------------------#
|
---|
[50fb011] | 305 | build_Makefile() { #
|
---|
[0170229] | 306 | #----------------------------#
|
---|
[50fb011] | 307 |
|
---|
[a702b4d] | 308 | echo "Creating Makefile... ${BOLD}START${OFF}"
|
---|
[03b3eba] | 309 |
|
---|
[0170229] | 310 | cd $JHALFSDIR/${PROGNAME}-commands
|
---|
| 311 |
|
---|
| 312 | # Start with a clean Makefile.tmp file
|
---|
[50fb011] | 313 | >$MKFILE
|
---|
[03b3eba] | 314 |
|
---|
[0170229] | 315 | chapter4_Makefiles
|
---|
| 316 | chapter5_Makefiles
|
---|
| 317 | chapter6_Makefiles
|
---|
[4edbc92] | 318 | # Add the iterations targets, if needed
|
---|
[47fddc8] | 319 | [[ "$COMPARE" = "y" ]] && wrt_compare_targets
|
---|
[9c9775f] | 320 | chapter78_Makefiles
|
---|
| 321 | # Add the CUSTOM_TOOLS targets, if needed
|
---|
| 322 | [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
|
---|
[fd7455c] | 323 | # Add the BLFS_TOOL targets, if needed
|
---|
| 324 | [[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets
|
---|
[0170229] | 325 |
|
---|
| 326 | # Add a header, some variables and include the function file
|
---|
| 327 | # to the top of the real Makefile.
|
---|
[9c9775f] | 328 | wrt_Makefile_header
|
---|
[0170229] | 329 |
|
---|
| 330 | # Add chroot commands
|
---|
[8381f6e] | 331 | CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
|
---|
[0170229] | 332 | i=1
|
---|
| 333 | for file in chapter06/*chroot* ; do
|
---|
[3b6adab] | 334 | chroot=`cat $file | tr -d '\n' | \
|
---|
[8381f6e] | 335 | sed -e "s@chroot@$CHROOT_LOC@" \
|
---|
[3b6adab] | 336 | -e 's@ \\\@ @g' \
|
---|
[f5f857d] | 337 | -e 's/ */ /g' \
|
---|
[8381f6e] | 338 | -e 's|\\$|&&|g' \
|
---|
| 339 | -e 's|"$$LFS"|$(MOUNT_PT)|' \
|
---|
[3b6adab] | 340 | -e 's|$| -c|'`
|
---|
[0170229] | 341 | echo -e "CHROOT$i= $chroot\n" >> $MKFILE
|
---|
| 342 | i=`expr $i + 1`
|
---|
| 343 | done
|
---|
| 344 |
|
---|
| 345 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
| 346 | # as a dependency.
|
---|
| 347 | (
|
---|
| 348 | cat << EOF
|
---|
[50fb011] | 349 |
|
---|
[9c9775f] | 350 | all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL
|
---|
[4012541] | 351 | @sudo make do_housekeeping
|
---|
[9c9775f] | 352 | @echo "$VERSION - jhalfs build" > lfs-release && \\
|
---|
| 353 | sudo mv lfs-release \$(MOUNT_PT)/etc
|
---|
[0170229] | 354 | @\$(call echo_finished,$VERSION)
|
---|
| 355 |
|
---|
[7d4cc81] | 356 | ck_UID:
|
---|
| 357 | @if [ \`id -u\` = "0" ]; then \\
|
---|
| 358 | echo "--------------------------------------------------"; \\
|
---|
| 359 | echo "You cannot run this makefile from the root account"; \\
|
---|
| 360 | echo "--------------------------------------------------"; \\
|
---|
| 361 | exit 1; \\
|
---|
| 362 | fi
|
---|
[0167dd8] | 363 |
|
---|
[50fb011] | 364 | mk_SETUP:
|
---|
| 365 | @\$(call echo_SU_request)
|
---|
[9c9775f] | 366 | @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
|
---|
[50fb011] | 367 | @touch \$@
|
---|
[03b3eba] | 368 |
|
---|
[50fb011] | 369 | mk_LUSER: mk_SETUP
|
---|
| 370 | @\$(call echo_SULUSER_request)
|
---|
[9c9775f] | 371 | @( sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) LUSER" )
|
---|
[621f01f] | 372 | @sudo make restore-luser-env
|
---|
[50fb011] | 373 | @touch \$@
|
---|
[7d4cc81] | 374 |
|
---|
| 375 | mk_SUDO: mk_LUSER
|
---|
[9c9775f] | 376 | @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
|
---|
| 377 | @touch \$@
|
---|
| 378 |
|
---|
[496f8f3] | 379 | mk_CHROOT: mk_SUDO
|
---|
[50fb011] | 380 | @\$(call echo_CHROOT_request)
|
---|
[9c9775f] | 381 | @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT")
|
---|
[50fb011] | 382 | @touch \$@
|
---|
| 383 |
|
---|
[03b3eba] | 384 | mk_BOOT: mk_CHROOT
|
---|
[50fb011] | 385 | @\$(call echo_CHROOT_request)
|
---|
[9c9775f] | 386 | @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT")
|
---|
[50fb011] | 387 | @touch \$@
|
---|
[03b3eba] | 388 |
|
---|
[9c9775f] | 389 | mk_CUSTOM_TOOLS: create-sbu_du-report
|
---|
| 390 | @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
|
---|
| 391 | \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
|
---|
| 392 | sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
|
---|
| 393 | (sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
|
---|
| 394 | fi;
|
---|
| 395 | @touch \$@
|
---|
[50fb011] | 396 |
|
---|
[9c9775f] | 397 | mk_BLFS_TOOL: mk_CUSTOM_TOOLS
|
---|
| 398 | @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
|
---|
| 399 | \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
|
---|
| 400 | sudo mkdir -p $BUILDDIR$TRACKING_DIR; \\
|
---|
| 401 | (sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BLFS_TOOL"); \\
|
---|
| 402 | fi;
|
---|
| 403 | @touch \$@
|
---|
[50fb011] | 404 |
|
---|
[7d4cc81] | 405 |
|
---|
[9c9775f] | 406 | SETUP: $chapter4
|
---|
| 407 | LUSER: $chapter5
|
---|
| 408 | SUDO: $runasroot
|
---|
| 409 | CHROOT: SHELL=/tools/bin/bash
|
---|
| 410 | CHROOT: $chapter6
|
---|
| 411 | BOOT: $chapter78
|
---|
| 412 | CUSTOM_TOOLS: $custom_list
|
---|
| 413 | BLFS_TOOL: $blfs_tool
|
---|
[50fb011] | 414 |
|
---|
[0170229] | 415 |
|
---|
[9c9775f] | 416 | create-sbu_du-report: mk_BOOT
|
---|
| 417 | @\$(call echo_message, Building)
|
---|
| 418 | @if [ "\$(ADD_REPORT)" = "y" ]; then \\
|
---|
| 419 | ./create-sbu_du-report.sh logs $VERSION; \\
|
---|
| 420 | \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
|
---|
| 421 | fi;
|
---|
| 422 | @touch \$@
|
---|
[0170229] | 423 |
|
---|
[30737ea8] | 424 | restore-luser-env:
|
---|
[0170229] | 425 | @\$(call echo_message, Building)
|
---|
[9c9775f] | 426 | @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
---|
| 427 | mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
|
---|
[0170229] | 428 | fi;
|
---|
[9c9775f] | 429 | @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
---|
| 430 | mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
|
---|
[0170229] | 431 | fi;
|
---|
[9c9775f] | 432 | @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash*
|
---|
| 433 | @\$(call housekeeping)
|
---|
[460ea63] | 434 |
|
---|
[3a27393] | 435 | do_housekeeping:
|
---|
[9199a13] | 436 | @-umount \$(MOUNT_PT)/sys
|
---|
| 437 | @-umount \$(MOUNT_PT)/proc
|
---|
| 438 | @-umount \$(MOUNT_PT)/dev/shm
|
---|
| 439 | @-umount \$(MOUNT_PT)/dev/pts
|
---|
| 440 | @-umount \$(MOUNT_PT)/dev
|
---|
[0167dd8] | 441 | @-rm /tools
|
---|
[30737ea8] | 442 | @-if [ ! -f luser-exist ]; then \\
|
---|
[9485eba] | 443 | userdel \$(LUSER); \\
|
---|
[9c9775f] | 444 | rm -rf \$(LUSER_HOME); \\
|
---|
[3a27393] | 445 | fi;
|
---|
[460ea63] | 446 |
|
---|
[9199a13] | 447 |
|
---|
[42346b2] | 448 | EOF
|
---|
| 449 | ) >> $MKFILE
|
---|
| 450 |
|
---|
[0170229] | 451 | # Bring over the items from the Makefile.tmp
|
---|
| 452 | cat $MKFILE.tmp >> $MKFILE
|
---|
| 453 | rm $MKFILE.tmp
|
---|
[a702b4d] | 454 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
| 455 | }
|
---|