- Timestamp:
- 08/08/2006 05:26:40 PM (18 years ago)
- Branches:
- 2.3, 2.3.x, 2.4, ablfs, ablfs-more, legacy, new_features, trunk
- Children:
- daa9b6c
- Parents:
- 983db9f
- Location:
- CLFS2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
CLFS2/config
r983db9f r6ad5a2f 21 21 #-------------------------------- 22 22 # >>>> MULTILIB 32/64 <<<< 23 24 #--- Unprivileged user and group name 25 LUSER=clfs 26 LGROUP=clfs 23 27 24 28 #--- Location of fstab file (if empty, a template is created) -
CLFS2/master.sh
r983db9f r6ad5a2f 5 5 ### FUNCTIONS ### 6 6 ################################### 7 8 #----------------------------------#9 wrt_ExecuteAsUser() { # Execute the file ($3) under the users account ($1), log in $210 #----------------------------------#11 local this_user=$112 local this_script=$213 local file=$314 (15 cat << EOF16 @( time { su - ${this_user} -c "source /home/${this_user}/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\17 echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script18 EOF19 ) >> $MKFILE.tmp20 }21 22 23 #----------------------------------#24 wrt_Unpack_SetOwner() { # Unpack and set owner. Assign 'ROOT' var25 #----------------------------------#26 local USER_ACCT=$127 local FILE=$228 local optSAVE_PREVIOUS=$329 30 if [ "${optSAVE_PREVIOUS}" != "1" ]; then31 wrt_remove_existing_dirs "$FILE"32 fi33 (34 cat << EOF35 @\$(call unpack,$FILE)36 @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\37 echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\38 chown -R ${USER_ACCT} \$(MOUNT_PT)\$(SRC)/\$\$ROOT39 EOF40 ) >> $MKFILE.tmp41 }42 7 43 8 … … 68 33 025-addinguser: 023-creatingtoolsdir 69 34 @\$(call echo_message, Building) 70 @if [ ! -d /home/ clfs]; then \\71 groupadd clfs; \\72 useradd -s /bin/bash -g clfs -m -k /dev/null clfs; \\35 @if [ ! -d /home/\$(LUSER) ]; then \\ 36 groupadd \$(LGROUP); \\ 37 useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\ 73 38 else \\ 74 touch user-clfs-exist; \\75 fi; 76 @chown clfs\$(MOUNT_PT) && \\77 chown clfs\$(MOUNT_PT)/tools && \\78 chown clfs\$(MOUNT_PT)/sources39 touch luser-exist; \\ 40 fi; 41 @chown \$(LUSER) \$(MOUNT_PT) && \\ 42 chown \$(LUSER) \$(MOUNT_PT)/tools && \\ 43 chown \$(LUSER) \$(MOUNT_PT)/sources 79 44 @touch \$@ && \\ 80 45 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ … … 83 48 026-settingenvironment: 025-addinguser 84 49 @\$(call echo_message, Building) 85 @if [ -f /home/ clfs/.bashrc -a ! -f /home/clfs/.bashrc.XXX ]; then \\86 mv /home/ clfs/.bashrc /home/clfs/.bashrc.XXX; \\87 fi; 88 @if [ -f /home/ clfs/.bash_profile -a ! -f /home/clfs/.bash_profile.XXX ]; then \\89 mv /home/ clfs/.bash_profile /home/clfs/.bash_profile.XXX; \\90 fi; 91 @echo "set +h" > /home/ clfs/.bashrc && \\92 echo "umask 022" >> /home/ clfs/.bashrc && \\93 echo "CLFS=\$(MOUNT_PT)" >> /home/ clfs/.bashrc && \\94 echo "LC_ALL=POSIX" >> /home/ clfs/.bashrc && \\95 echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> /home/ clfs/.bashrc && \\96 echo "export CLFS LC_ALL PATH" >> /home/ clfs/.bashrc && \\97 echo "" >> /home/ clfs/.bashrc && \\98 echo "unset CFLAGS" >> /home/ clfs/.bashrc && \\99 echo "unset CXXFLAGS" >> /home/ clfs/.bashrc && \\100 echo "" >> /home/ clfs/.bashrc && \\101 echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/ clfs/.bashrc && \\102 echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/ clfs/.bashrc && \\103 echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/ clfs/.bashrc && \\104 echo "source $JHALFSDIR/envars" >> /home/ clfs/.bashrc105 @chown clfs:clfs /home/clfs/.bashrc && \\50 @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ 51 mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\ 52 fi; 53 @if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ 54 mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\ 55 fi; 56 @echo "set +h" > /home/\$(LUSER)/.bashrc && \\ 57 echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\ 58 echo "CLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\ 59 echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\ 60 echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\ 61 echo "export CLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\ 62 echo "" >> /home/\$(LUSER)/.bashrc && \\ 63 echo "unset CFLAGS" >> /home/\$(LUSER)/.bashrc && \\ 64 echo "unset CXXFLAGS" >> /home/\$(LUSER)/.bashrc && \\ 65 echo "" >> /home/\$(LUSER)/.bashrc && \\ 66 echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/\$(LUSER)/.bashrc && \\ 67 echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/\$(LUSER)/.bashrc && \\ 68 echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\ 69 echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc 70 @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\ 106 71 touch envars 107 72 @touch \$@ && \\ … … 154 119 @touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp} 155 120 @chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog 156 @chown -R clfs\$(MOUNT_PT)121 @chown -R \$(LUSER) \$(MOUNT_PT) 157 122 158 123 @touch \$@ && \\ … … 163 128 ) >> $MKFILE.tmp 164 129 } 165 166 130 167 131 … … 176 140 # 177 141 # Skip this script... 142 # NOTE.. the book indicated you only needed to install groff or file if the host 143 # had older versions. The packages would be installed in the target directory 144 # and not the host. 178 145 case $this_script in 179 146 *cflags* | *variables* ) # work done in host_prep_Makefiles 180 continue; ;; 147 continue ;; 148 *file ) FileVer=`file --version | head -n1 | cut -d " " -f1` 149 [[ "$FileVer" = "file-4.17" ]] && continue 150 ;; 151 *groff) GroffVer=`groff --version | head -n1 | cut -d " " -f4` 152 [[ "$GroffVer" = "1.19.2" ]] && continue 153 ;; 181 154 *) ;; 182 155 esac 156 183 157 # 184 158 # Set the dependency for the first target. … … 200 174 esac 201 175 pkg_tarball=$(get_package_tarball_name $name) 202 203 176 #--------------------------------------------------------------------# 204 177 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # … … 211 184 # If $pkg_tarball isn't empty, we've got a package... 212 185 if [ "$pkg_tarball" != "" ] ; then 213 wrt_ Unpack_SetOwner "clfs""$pkg_tarball"186 wrt_unpack "$pkg_tarball" 214 187 # If using optimizations, write the instructions 215 188 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name" 216 189 fi 217 190 # 218 wrt_ ExecuteAsUser "clfs""${this_script}" "${file}"191 wrt_RunAsUser "${this_script}" "${file}" 219 192 # 220 193 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" … … 276 249 # If $pkg_tarball isn't empty, we've got a package... 277 250 if [ "$pkg_tarball" != "" ] ; then 278 wrt_ Unpack_SetOwner "clfs""$pkg_tarball"251 wrt_unpack "$pkg_tarball" 279 252 # If using optimizations, write the instructions 280 253 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name" 281 254 fi 282 255 # 283 wrt_ ExecuteAsUser "clfs""${this_script}" "${file}"256 wrt_RunAsUser "${this_script}" "${file}" 284 257 # 285 258 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" … … 340 313 # 341 314 # If $pkg_tarball isn't empty, we've got a package... 342 [[ "$pkg_tarball" != "" ]] && wrt_ Unpack_SetOwner "clfs""$pkg_tarball"343 # 344 wrt_ ExecuteAsUser "clfs""${this_script}" "${file}"315 [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball" 316 # 317 wrt_RunAsUser "${this_script}" "${file}" 345 318 # 346 319 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" … … 402 375 # 403 376 # If $pkg_tarball isn't empty, we've got a package... 404 [[ "$pkg_tarball" != "" ]] && wrt_ Unpack_SetOwner "clfs""$pkg_tarball"377 [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball" 405 378 # 406 379 # Select a script execution method … … 409 382 wrt_copy_fstab "${this_script}" 410 383 else 411 wrt_ ExecuteAsUser "clfs""${this_script}" "${file}"384 wrt_RunAsUser "${this_script}" "${file}" 412 385 fi 413 386 ;; 414 *) wrt_ExecuteAsUser "clfs" "${this_script}" "${file}" 415 ;; 387 *chowning) wrt_RunAsRoot "${this_script}" "${file}" 388 ;; 389 *) wrt_RunAsUser "${this_script}" "${file}" 390 ;; 416 391 esac 417 392 # … … 461 436 MOUNT_PT= $BUILDDIR 462 437 PKG_LST= $PKG_LST 438 LUSER= $LUSER 439 LGROUP= $LGROUP 463 440 464 441 include makefile-functions … … 471 448 ( 472 449 cat << EOF 473 all: chapter2 chapter3 chapter4 chapter5 chapter6 do-housekeeping450 all: chapter2 chapter3 chapter4 chapter5 chapter6 restore-luser-env do-housekeeping 474 451 @\$(call echo_finished,$VERSION) 475 452 … … 492 469 @echo "This feature does not exist for the CLFS makefile. (yet)" 493 470 494 restore- clfs-env:495 @\$(call echo_message, Building) 496 @if [ -f /home/ clfs/.bashrc.XXX ]; then \\497 mv -f /home/ clfs/.bashrc.XXX /home/clfs/.bashrc; \\498 fi; 499 @if [ -f /home/ clfs/.bash_profile.XXX ]; then \\500 mv /home/ clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\501 fi; 502 @chown clfs:clfs /home/clfs/.bash* && \\471 restore-luser-env: 472 @\$(call echo_message, Building) 473 @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ 474 mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\ 475 fi; 476 @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ 477 mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\ 478 fi; 479 @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\ 503 480 touch \$@ && \\ 504 481 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ … … 506 483 507 484 do-housekeeping: 508 @-if [ ! -f user-clfs-exist ]; then \\509 userdel clfs; \\510 rm -rf /home/ clfs; \\485 @-if [ ! -f luser-exist ]; then \\ 486 userdel \$(LUSER); \\ 487 rm -rf /home/\$(LUSER); \\ 511 488 fi; 512 489
Note:
See TracChangeset
for help on using the changeset viewer.