Changeset 9485eba
- Timestamp:
- 08/04/2006 08:06:15 PM (18 years ago)
- Branches:
- experimental
- Children:
- 3ba96f2
- Parents:
- 725ae5a
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
CLFS/config
r725ae5a r9485eba 6 6 # 7 7 ##### 8 9 #--- Unprivileged user and group name 10 LUSER=clfs 11 LGROUP=clfs 8 12 9 13 #--- Which target architecture you want to build for, … … 38 42 # NOTE: not all combinations are 'bootable' yet. 39 43 METHOD=chroot 44 45 #--- Unprivileged user and group name 46 LUSER=clfs 47 LGROUP=clfs 40 48 41 49 #--- Location of fstab file (if empty, a template is created) -
CLFS/master.sh
r725ae5a r9485eba 42 42 025-addinguser: 024-creatingcrossdir 43 43 @\$(call echo_message, Building) 44 @if [ ! -d /home/ clfs]; then \\45 groupadd clfs; \\46 useradd -s /bin/bash -g clfs -m -k /dev/null clfs; \\44 @if [ ! -d /home/\$(LUSER) ]; then \\ 45 groupadd \$(LGROUP); \\ 46 useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\ 47 47 else \\ 48 48 touch user-clfs-exist; \\ 49 49 fi; 50 @chown clfs\$(MOUNT_PT) && \\51 chown clfs\$(MOUNT_PT)/tools && \\52 chown clfs\$(MOUNT_PT)/cross-tools && \\53 chown clfs\$(MOUNT_PT)/sources && \\50 @chown \$(LUSER) \$(MOUNT_PT) && \\ 51 chown \$(LUSER) \$(MOUNT_PT)/tools && \\ 52 chown \$(LUSER) \$(MOUNT_PT)/cross-tools && \\ 53 chown \$(LUSER) \$(MOUNT_PT)/sources && \\ 54 54 touch \$@ && \\ 55 55 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ … … 58 58 026-settingenvironment: 025-addinguser 59 59 @\$(call echo_message, Building) 60 @if [ -f /home/ clfs/.bashrc -a ! -f /home/clfs/.bashrc.XXX ]; then \\61 mv /home/ clfs/.bashrc /home/clfs/.bashrc.XXX; \\60 @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ 61 mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\ 62 62 fi; 63 @if [ -f /home/ clfs/.bash_profile -a ! -f /home/clfs/.bash_profile.XXX ]; then \\64 mv /home/ clfs/.bash_profile /home/clfs/.bash_profile.XXX; \\63 @if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ 64 mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\ 65 65 fi; 66 @echo "set +h" > /home/ clfs/.bashrc && \\67 echo "umask 022" >> /home/ clfs/.bashrc && \\68 echo "CLFS=\$(MOUNT_PT)" >> /home/ clfs/.bashrc && \\69 echo "LC_ALL=POSIX" >> /home/ clfs/.bashrc && \\70 echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/ clfs/.bashrc && \\71 echo "export CLFS LC_ALL PATH" >> /home/ clfs/.bashrc && \\72 echo "" >> /home/ clfs/.bashrc && \\73 echo "unset CFLAGS" >> /home/ clfs/.bashrc && \\74 echo "unset CXXFLAGS" >> /home/ clfs/.bashrc && \\75 echo "" >> /home/ clfs/.bashrc && \\76 echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/ clfs/.bashrc && \\77 echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/ clfs/.bashrc && \\78 echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/ clfs/.bashrc && \\79 echo "source $JHALFSDIR/envars" >> /home/ clfs/.bashrc80 @chown clfs:clfs /home/clfs/.bashrc && \\66 @echo "set +h" > /home/\$(LUSER)/.bashrc && \\ 67 echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\ 68 echo "CLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\ 69 echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\ 70 echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\ 71 echo "export CLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\ 72 echo "" >> /home/\$(LUSER)/.bashrc && \\ 73 echo "unset CFLAGS" >> /home/\$(LUSER)/.bashrc && \\ 74 echo "unset CXXFLAGS" >> /home/\$(LUSER)/.bashrc && \\ 75 echo "" >> /home/\$(LUSER)/.bashrc && \\ 76 echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/\$(LUSER)/.bashrc && \\ 77 echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/\$(LUSER)/.bashrc && \\ 78 echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\ 79 echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc 80 @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\ 81 81 touch envars && \\ 82 82 touch \$@ && \\ … … 132 132 # If $pkg_tarball isn't empty, we've got a package... 133 133 # 134 [[ "$pkg_tarball" != "" ]] && wrt_unpack _clfs"$pkg_tarball"135 # 136 wrt_ run_as_clfs_su"${this_script}" "${file}"134 [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball" 135 # 136 wrt_RunAsUser "${this_script}" "${file}" 137 137 # 138 138 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" … … 191 191 # Insert instructions for unpacking the package and to set the PKGDIR variable. 192 192 # 193 [[ "$pkg_tarball" != "" ]] && wrt_unpack _clfs"$pkg_tarball"193 [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball" 194 194 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name" 195 195 # 196 wrt_ run_as_clfs_su"${this_script}" "${file}"196 wrt_RunAsUser "${this_script}" "${file}" 197 197 # 198 198 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" … … 263 263 # Insert instructions for unpacking the package and changing directories 264 264 # 265 [[ "$pkg_tarball" != "" ]] && wrt_unpack _clfs"$pkg_tarball"265 [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball" 266 266 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name" 267 267 # 268 268 # Select a script execution method 269 269 case $this_script in 270 *changingowner*) wrt_ run_as_clfs_root "${this_script}" "${file}" ;;271 *devices*) wrt_ run_as_clfs_root "${this_script}" "${file}" ;;270 *changingowner*) wrt_RunAsRoot "${this_script}" "${file}" ;; 271 *devices*) wrt_RunAsRoot "${this_script}" "${file}" ;; 272 272 *fstab*) if [[ -n "$FSTAB" ]]; then 273 273 wrt_copy_fstab "${this_script}" 274 274 else 275 wrt_ run_as_clfs_su"${this_script}" "${file}"275 wrt_RunAsUser "${this_script}" "${file}" 276 276 fi 277 277 ;; 278 *) wrt_ run_as_clfs_su"${this_script}" "${file}" ;;278 *) wrt_RunAsUser "${this_script}" "${file}" ;; 279 279 esac 280 280 # … … 333 333 if [ "$pkg_tarball" != "" ] ; then 334 334 case $this_script in 335 *util-linux) wrt_unpack _clfs"$pkg_tarball" ;;335 *util-linux) wrt_unpack "$pkg_tarball" ;; 336 336 *) wrt_unpack2 "$pkg_tarball" ;; 337 337 esac … … 341 341 # Select a script execution method 342 342 case $this_script in 343 *kernfs) wrt_run_as_clfs_root "${this_script}" "${file}" ;;344 *util-linux) wrt_run_as_clfs_su"${this_script}" "${file}" ;;345 *) wrt_run_as_chroot1"${this_script}" "${file}" ;;343 *kernfs) wrt_RunAsRoot "${this_script}" "${file}" ;; 344 *util-linux) wrt_RunAsUser "${this_script}" "${file}" ;; 345 *) wrt_run_as_chroot1 "${this_script}" "${file}" ;; 346 346 esac 347 347 # … … 758 758 759 759 case $this_script in 760 *udev *) continue ;; # This is not a script but a commentary760 *udev) continue ;; # This is not a script but a commentary 761 761 *console*) continue ;; # Use the files that came with the bootscripts 762 762 *) ;; … … 774 774 -e 's@n32@@'` 775 775 case $name in 776 *bootscripts*) name=bootscripts-cross-lfs 777 ;;776 *bootscripts*) name=bootscripts-cross-lfs ;; 777 *udev-rules) name=udev-cross-lfs ;; 778 778 esac 779 779 … … 1013 1013 MOUNT_PT= $BUILDDIR 1014 1014 PKG_LST= $PKG_LST 1015 LUSER= $LUSER 1016 LGROUP= $LGROUP 1015 1017 1016 1018 include makefile-functions … … 1065 1067 clean-chapter2: 1066 1068 -if [ ! -f user-clfs-exist ]; then \\ 1067 userdel clfs; \\1068 rm -rf /home/ clfs; \\1069 userdel \$(LUSER); \\ 1070 rm -rf /home/\$(LUSER); \\ 1069 1071 fi; 1070 1072 rm -rf \$(MOUNT_PT)/tools … … 1093 1095 restore-clfs-env: 1094 1096 @\$(call echo_message, Building) 1095 @if [ -f /home/ clfs/.bashrc.XXX ]; then \\1096 mv -f /home/ clfs/.bashrc.XXX /home/clfs/.bashrc; \\1097 @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ 1098 mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\ 1097 1099 fi; 1098 @if [ -f /home/ clfs/.bash_profile.XXX ]; then \\1099 mv /home/ clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\1100 @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ 1101 mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\ 1100 1102 fi; 1101 @chown clfs:clfs /home/clfs/.bash* && \\1103 @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\ 1102 1104 touch \$@ && \\ 1103 1105 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ … … 1111 1113 @-umount \$(MOUNT_PT)/proc 1112 1114 @-if [ ! -f user-clfs-exist ]; then \\ 1113 userdel clfs; \\1114 rm -rf /home/ clfs; \\1115 userdel \$(LUSER); \\ 1116 rm -rf /home/\$(LUSER); \\ 1115 1117 fi; 1116 1118 … … 1147 1149 clean-jhalfs: 1148 1150 -if [ ! -f user-clfs-exist ]; then \\ 1149 userdel clfs; \\1150 rm -rf /home/ clfs; \\1151 userdel \$(LUSER); \\ 1152 rm -rf /home/\$(LUSER); \\ 1151 1153 fi; 1152 1154 rm -rf \$(MOUNT_PT)/tools … … 1178 1180 restore-clfs-env: 1179 1181 @\$(call echo_message, Building) 1180 @if [ -f /home/ clfs/.bashrc.XXX ]; then \\1181 mv -fv /home/ clfs/.bashrc.XXX /home/clfs/.bashrc; \\1182 @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ 1183 mv -fv /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\ 1182 1184 fi; 1183 @if [ -f /home/ clfs/.bash_profile.XXX ]; then \\1184 mv -v /home/ clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\1185 @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ 1186 mv -v /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\ 1185 1187 fi; 1186 @chown clfs:clfs /home/clfs/.bash* && \\1188 @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\ 1187 1189 touch \$@ && \\ 1188 1190 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ -
CLFS2/config
r725ae5a r9485eba 6 6 # 7 7 ##### 8 #--- Unprivileged user and group name 9 LUSER=clfs 10 LGROUP=clfs 11 8 12 9 13 #--- Which target architecture you want to build for, … … 21 25 #-------------------------------- 22 26 # >>>> MULTILIB 32/64 <<<< 27 28 #--- Unprivileged user and group name 29 LUSER=clfs 30 LGROUP=clfs 23 31 24 32 #--- Location of fstab file (if empty, a template is created) -
CLFS2/master.sh
r725ae5a r9485eba 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 39 touch user-clfs-exist; \\ 75 40 fi; 76 @chown clfs\$(MOUNT_PT) && \\77 chown clfs\$(MOUNT_PT)/tools && \\78 chown clfs\$(MOUNT_PT)/sources41 @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 \$@ && \\ … … 200 165 esac 201 166 pkg_tarball=$(get_package_tarball_name $name) 202 203 167 #--------------------------------------------------------------------# 204 168 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # … … 211 175 # If $pkg_tarball isn't empty, we've got a package... 212 176 if [ "$pkg_tarball" != "" ] ; then 213 wrt_ Unpack_SetOwner "clfs""$pkg_tarball"177 wrt_unpack "$pkg_tarball" 214 178 # If using optimizations, write the instructions 215 179 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name" 216 180 fi 217 181 # 218 wrt_ ExecuteAsUser "clfs""${this_script}" "${file}"182 wrt_RunAsUser "${this_script}" "${file}" 219 183 # 220 184 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" … … 309 273 # If $pkg_tarball isn't empty, we've got a package... 310 274 if [ "$pkg_tarball" != "" ] ; then 311 wrt_ Unpack_SetOwner "clfs""$pkg_tarball"275 wrt_unpack "$pkg_tarball" 312 276 # If using optimizations, write the instructions 313 277 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name" 314 278 fi 315 279 # 316 wrt_ ExecuteAsUser "clfs""${this_script}" "${file}"280 wrt_RunAsUser "${this_script}" "${file}" 317 281 # 318 282 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" … … 375 339 # 376 340 # If $pkg_tarball isn't empty, we've got a package... 377 [[ "$pkg_tarball" != "" ]] && wrt_ Unpack_SetOwner "clfs""$pkg_tarball"378 # 379 wrt_ ExecuteAsUser "clfs""${this_script}" "${file}"341 [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball" 342 # 343 wrt_RunAsUser "${this_script}" "${file}" 380 344 # 381 345 [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" … … 437 401 # 438 402 # If $pkg_tarball isn't empty, we've got a package... 439 [[ "$pkg_tarball" != "" ]] && wrt_ Unpack_SetOwner "clfs""$pkg_tarball"403 [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball" 440 404 # 441 405 # Select a script execution method … … 444 408 wrt_copy_fstab "${this_script}" 445 409 else 446 wrt_ ExecuteAsUser "clfs""${this_script}" "${file}"410 wrt_RunAsUser "${this_script}" "${file}" 447 411 fi 448 412 ;; 449 *) wrt_ExecuteAsUser "clfs" "${this_script}" "${file}" 413 *chowning) wrt_RunAsRoot "${this_script}" "${file}" 414 ;; 415 *) wrt_RunAsUser "${this_script}" "${file}" 450 416 ;; 451 417 esac … … 496 462 MOUNT_PT= $BUILDDIR 497 463 PKG_LST= $PKG_LST 464 LUSER= $LUSER 465 LGROUP= $LGROUP 498 466 499 467 include makefile-functions … … 529 497 restore-clfs-env: 530 498 @\$(call echo_message, Building) 531 @if [ -f /home/ clfs/.bashrc.XXX ]; then \\532 mv -f /home/ clfs/.bashrc.XXX /home/clfs/.bashrc; \\533 fi; 534 @if [ -f /home/ clfs/.bash_profile.XXX ]; then \\535 mv /home/ clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\536 fi; 537 @chown clfs:clfs /home/clfs/.bash* && \\499 @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ 500 mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\ 501 fi; 502 @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ 503 mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\ 504 fi; 505 @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\ 538 506 touch \$@ && \\ 539 507 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ … … 542 510 do-housekeeping: 543 511 @-if [ ! -f user-clfs-exist ]; then \\ 544 userdel clfs; \\545 rm -rf /home/ clfs; \\512 userdel \$(LUSER); \\ 513 rm -rf /home/\$(LUSER); \\ 546 514 fi; 547 515 -
Config.in
r725ae5a r9485eba 30 30 31 31 32 32 33 #--- Book version 33 34 #menu "Book Version" … … 59 60 # 60 61 #endmenu 61 62 62 #----------------------- 63 64 #--- Set User Account 65 config CONFIG_USER 66 bool "Change the default user/group for this build" 67 default n 68 help #--- Unprivileged user and group name 69 # If you do not have the priv to create/delete 70 # users and groups you can specifiy your own 71 # user id for the build 72 # default values for each book 73 # LFS lfs 74 # CLFS clfs 75 # CLFS2 clfs 76 # HLFS hlfs 77 78 config DEF_USER 79 string 80 default "lfs" if BOOK_LFS 81 default "blfs" if BOOK_BLFS 82 default "clfs" if BOOK_CLFS || BOOK_CLFS2 83 default "hlfs" if BOOK_HLFS 84 85 config SET_USER 86 string "User account" 87 depends CONFIG_USER 88 default DEF_USER 89 90 91 config CONFIG_GROUP 92 bool "Set Group?" 93 default n 94 depends CONFIG_USER 95 96 config SET_GROUP 97 string "GROUP account" 98 depends CONFIG_GROUP 99 default DEF_USER 100 101 config LUSER 102 string 103 default DEF_USER if !CONFIG_USER 104 default SET_USER if CONFIG_USER 105 106 config LGROUP 107 string 108 default LUSER if !CONFIG_GROUP 109 default SET_GROUP if CONFIG_GROUP 110 ------------------------ 63 111 64 112 comment "--------CLFS specific params---------" -
HLFS/config
r725ae5a r9485eba 7 7 ##### 8 8 9 #--- Unprivileged user and group name 10 LUSER=hlfs 11 LGROUP=hlfs 12 9 13 #--- Which library model to use uclibc/glibc 10 14 MODEL=glibc … … 12 16 #--- The host system has grsecurity options enabled? 0(no)/1(yes) 13 17 GRSECURITY_HOST=0 18 19 #--- Unprivileged user and group name 20 LUSER=hlfs 21 LGROUP=hlfs 14 22 15 23 #--- Location of fstab file (if empty, a template is created) -
HLFS/master.sh
r725ae5a r9485eba 7 7 ### FUNCTIONS ### 8 8 ################################### 9 10 #----------------------------------#11 wrt_ExecuteAsUser() { # Execute the file ($3) under the users account ($1), log in $212 #----------------------------------#13 local this_user=$114 local this_script=$215 local file=$316 17 (18 cat << EOF19 @( time { su - ${this_user} -c "source /home/${this_user}/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\20 echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script21 EOF22 ) >> $MKFILE.tmp23 }24 25 26 #----------------------------------#27 wrt_Unpack_SetOwner() { # Unpack and set owner. Assign 'ROOT' var28 #----------------------------------#29 local USER_ACCT=$130 local FILE=$231 local optSAVE_PREVIOUS=$332 33 if [ "${optSAVE_PREVIOUS}" != "1" ]; then34 wrt_remove_existing_dirs "$FILE"35 fi36 (37 cat << EOF38 @\$(call unpack,$FILE)39 @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\40 echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\41 chown -R ${USER_ACCT} \$(MOUNT_PT)\$(SRC)/\$\$ROOT42 EOF43 ) >> $MKFILE.tmp44 }45 46 #----------------------------------#47 wrt_RunAsRoot() { # Some scripts must be run as root..48 #----------------------------------#49 local user_ACCT=$(echo $1 | tr [a-z] [A-Z])50 local this_script=$251 local file=$352 53 (54 cat << EOF55 @( time { export ${user_ACCT}=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\56 echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script57 EOF58 ) >> $MKFILE.tmp59 }60 61 9 62 10 #----------------------------# … … 86 34 EOF 87 35 ) >> $MKFILE.tmp 88 wrt_ ExecuteAsUser "hlfs""$toolchain" "$this_script"36 wrt_RunAsUser "$toolchain" "$this_script" 89 37 ;; 90 38 esac 91 39 # 92 # Safe method to remove packages unpacked outside the toolchain40 # Safe method to remove packages unpacked while inside the toolchain script 93 41 pkg_tarball=$(get_package_tarball_name "binutils") 94 42 wrt_remove_existing_dirs "$pkg_tarball" … … 141 89 021-addinguser: 020-creatingtoolsdir 142 90 @\$(call echo_message, Building) 143 @if [ ! -d /home/ hlfs]; then \\144 groupadd hlfs; \\145 useradd -s /bin/bash -g hlfs -m -k /dev/null hlfs; \\91 @if [ ! -d /home/\$(LUSER) ]; then \\ 92 groupadd \$(LGROUP); \\ 93 useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\ 146 94 else \\ 147 95 touch user-hlfs-exist; \\ 148 96 fi; 149 @chown hlfs\$(MOUNT_PT)/tools && \\150 chown hlfs\$(MOUNT_PT)/sources && \\97 @chown \$(LUSER) \$(MOUNT_PT)/tools && \\ 98 chown \$(LUSER) \$(MOUNT_PT)/sources && \\ 151 99 touch \$@ && \\ 152 100 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ … … 155 103 022-settingenvironment: 021-addinguser 156 104 @\$(call echo_message, Building) 157 @if [ -f /home/ hlfs/.bashrc -a ! -f /home/hlfs/.bashrc.XXX ]; then \\158 mv /home/ hlfs/.bashrc /home/hlfs/.bashrc.XXX; \\159 fi; 160 @if [ -f /home/ hlfs/.bash_profile -a ! -f /home/hlfs/.bash_profile.XXX ]; then \\161 mv /home/ hlfs/.bash_profile /home/hlfs/.bash_profile.XXX; \\162 fi; 163 @echo "set +h" > /home/ hlfs/.bashrc && \\164 echo "umask 022" >> /home/ hlfs/.bashrc && \\165 echo "HLFS=\$(MOUNT_PT)" >> /home/ hlfs/.bashrc && \\166 echo "LC_ALL=POSIX" >> /home/ hlfs/.bashrc && \\167 echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/ hlfs/.bashrc && \\168 echo "export HLFS LC_ALL PATH" >> /home/ hlfs/.bashrc && \\169 echo "" >> /home/ hlfs/.bashrc && \\170 echo "target=$(uname -m)-${TARGET}" >> /home/ lfs/.bashrc && \\171 echo "ldso=/tools/lib/${LOADER}" >> /home/ lfs/.bashrc && \\172 echo "export target ldso" >> /home/ lfs/.bashrc && \\173 echo "source $JHALFSDIR/envars" >> /home/ hlfs/.bashrc && \\174 chown hlfs:hlfs /home/hlfs/.bashrc && \\105 @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ 106 mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\ 107 fi; 108 @if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ 109 mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\ 110 fi; 111 @echo "set +h" > /home/\$(LUSER)/.bashrc && \\ 112 echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\ 113 echo "HLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\ 114 echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\ 115 echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\ 116 echo "export HLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\ 117 echo "" >> /home/\$(LUSER)/.bashrc && \\ 118 echo "target=$(uname -m)-${TARGET}" >> /home/\$(LUSER)/.bashrc && \\ 119 echo "ldso=/tools/lib/${LOADER}" >> /home/\$(LUSER)/.bashrc && \\ 120 echo "export target ldso" >> /home/\$(LUSER)/.bashrc && \\ 121 echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\ 122 chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\ 175 123 touch envars && \\ 176 124 touch \$@ && \\ … … 247 195 if [ "$pkg_tarball" != "" ] ; then 248 196 # Insert instructions for unpacking the package and to set the PKGDIR variable. 249 wrt_ Unpack_SetOwner "hlfs""$pkg_tarball"197 wrt_unpack "$pkg_tarball" 250 198 # If using optimizations, write the instructions 251 199 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name" … … 253 201 # Insert date and disk usage at the top of the log file, the script run 254 202 # and date and disk usage again at the bottom of the log file. 255 wrt_ ExecuteAsUser "hlfs""$this_script" "${file}"203 wrt_RunAsUser "$this_script" "${file}" 256 204 257 205 # Remove the build directory(ies) except if the package build fails … … 380 328 case "${this_script}" in 381 329 *kernfs*) 382 wrt_RunAsRoot " hlfs" "${this_script}" "${file}"330 wrt_RunAsRoot "${this_script}" "${file}" 383 331 ;; 384 332 *) # The rest of Chapter06 … … 522 470 MOUNT_PT= $BUILDDIR 523 471 PKG_LST= $PKG_LST 472 LUSER= $LUSER 473 LGROUP= $LGROUP 524 474 525 475 include makefile-functions … … 569 519 clean-chapter3: 570 520 -if [ ! -f user-hlfs-exist ]; then \\ 571 userdel hlfs; \\572 rm -rf /home/ hlfs; \\521 userdel \$(LUSER); \\ 522 rm -rf /home/\$(LUSER); \\ 573 523 fi; 574 524 rm -rf \$(MOUNT_PT)/tools … … 598 548 restore-hlfs-env: 599 549 @\$(call echo_message, Building) 600 @if [ -f /home/ hlfs/.bashrc.XXX ]; then \\601 mv -f /home/ hlfs/.bashrc.XXX /home/hlfs/.bashrc; \\602 fi; 603 @if [ -f /home/ hlfs/.bash_profile.XXX ]; then \\604 mv /home/ hlfs/.bash_profile.XXX /home/hlfs/.bash_profile; \\605 fi; 606 @chown hlfs:hlfs /home/hlfs/.bash* && \\550 @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ 551 mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\ 552 fi; 553 @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ 554 mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\ 555 fi; 556 @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\ 607 557 touch \$@ && \\ 608 558 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ … … 616 566 @-umount \$(MOUNT_PT)/proc 617 567 @-if [ ! -f user-hlfs-exist ]; then \\ 618 userdel hlfs; \\619 rm -rf /home/ hlfs; \\568 userdel \$(LUSER); \\ 569 rm -rf /home/\$(LUSER); \\ 620 570 fi; 621 571 -
LFS/config
r725ae5a r9485eba 6 6 # 7 7 ##### 8 9 #--- Unprivileged user and group name 10 LUSER=lfs 11 LGROUP=lfs 8 12 9 13 #--- Location of fstab file (if empty, a template is created) -
LFS/master.sh
r725ae5a r9485eba 30 30 021-addinguser: 020-creatingtoolsdir 31 31 @\$(call echo_message, Building) 32 @if [ ! -d /home/ lfs]; then \\33 groupadd lfs; \\34 useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\32 @if [ ! -d /home/\$(LUSER) ]; then \\ 33 groupadd \$(LGROUP); \\ 34 useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\ 35 35 else \\ 36 36 touch user-lfs-exist; \\ 37 37 fi; 38 @chown lfs\$(MOUNT_PT)/tools && \\38 @chown \$(LUSER) \$(MOUNT_PT)/tools && \\ 39 39 chmod a+wt \$(MOUNT_PT)/sources && \\ 40 40 touch \$@ && \\ … … 44 44 022-settingenvironment: 021-addinguser 45 45 @\$(call echo_message, Building) 46 @if [ -f /home/ lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\47 mv /home/ lfs/.bashrc /home/lfs/.bashrc.XXX; \\48 fi; 49 @if [ -f /home/ lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\50 mv /home/ lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\51 fi; 52 @echo "set +h" > /home/ lfs/.bashrc && \\53 echo "umask 022" >> /home/ lfs/.bashrc && \\54 echo "LFS=\$(MOUNT_PT)" >> /home/ lfs/.bashrc && \\55 echo "LC_ALL=POSIX" >> /home/ lfs/.bashrc && \\56 echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/ lfs/.bashrc && \\57 echo "export LFS LC_ALL PATH" >> /home/ lfs/.bashrc && \\58 echo "source $JHALFSDIR/envars" >> /home/ lfs/.bashrc && \\59 chown lfs:lfs /home/lfs/.bashrc && \\46 @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ 47 mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\ 48 fi; 49 @if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ 50 mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\ 51 fi; 52 @echo "set +h" > /home/\$(LUSER)/.bashrc && \\ 53 echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\ 54 echo "LFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\ 55 echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\ 56 echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\ 57 echo "export LFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\ 58 echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\ 59 chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\ 60 60 touch envars && \\ 61 61 touch \$@ && \\ … … 123 123 # The changingowner script must be run as root. 124 124 case "${this_script}" in 125 *changingowner) wrt_ run_as_root"${this_script}" "$file" ;;126 *) wrt_ run_as_su"${this_script}" "$file" ;;125 *changingowner) wrt_RunAsRoot "${this_script}" "$file" ;; 126 *) wrt_RunAsUser "${this_script}" "$file" ;; 127 127 esac 128 128 … … 235 235 # and not to use chroot. 236 236 case "${this_script}" in 237 *kernfs) wrt_ run_as_root "${this_script}" "$file" ;;237 *kernfs) wrt_RunAsRoot "${this_script}" "$file" ;; 238 238 *) wrt_run_as_chroot1 "${this_script}" "$file" ;; 239 239 esac … … 369 369 MOUNT_PT= $BUILDDIR 370 370 PKG_LST= $PKG_LST 371 LUSER= $LUSER 372 LGROUP= $LGROUP 371 373 372 374 include makefile-functions … … 410 412 clean-chapter4: 411 413 -if [ ! -f user-lfs-exist ]; then \\ 412 userdel lfs; \\413 rm -rf /home/ lfs; \\414 userdel \$(LUSER); \\ 415 rm -rf /home/\$(LUSER); \\ 414 416 fi; 415 417 rm -rf \$(MOUNT_PT)/tools … … 439 441 restore-lfs-env: 440 442 @\$(call echo_message, Building) 441 @if [ -f /home/ lfs/.bashrc.XXX ]; then \\442 mv -f /home/ lfs/.bashrc.XXX /home/lfs/.bashrc; \\443 fi; 444 @if [ -f /home/ lfs/.bash_profile.XXX ]; then \\445 mv /home/ lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\446 fi; 447 @chown lfs:lfs /home/lfs/.bash* && \\443 @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ 444 mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\ 445 fi; 446 @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ 447 mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\ 448 fi; 449 @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\ 448 450 touch \$@ && \\ 449 451 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ … … 457 459 @-umount \$(MOUNT_PT)/dev 458 460 @-if [ ! -f user-lfs-exist ]; then \\ 459 userdel lfs; \\460 rm -rf /home/ lfs; \\461 userdel \$(LUSER); \\ 462 rm -rf /home/\$(LUSER); \\ 461 463 fi; 462 464 -
README
r725ae5a r9485eba 33 33 34 34 We have installed the familiar menu based configuration tool driven by 35 make. If you type the command <make> you will be presented with a list of 36 configurable parameters (starting with the book you wish to use). All the 37 parameters found in the individual config files are available. Once you 38 have finished setting the parameters and exit the make file will launch 39 the chosen book version of jhalfs. JHALFS will import your created file 40 and overider the values found in normal "config" files. 35 make. If you type the command 36 make 37 you will be presented with a list of configurable parameters (starting 38 with the book you wish to use). All the parameters found in the individual 39 config files are available. Once you have finished setting the parameters 40 and exit the make file will launch the chosen book version of jhalfs. 41 JHALFS will import your created file and overider the values found in normal 42 "config" files. 41 43 ..note.. The generated file <configuration> is only used by jhalfs if you 42 44 run jhalfs via make otherwise it is ignored. 43 45 46 If you want to try out the new configuration system without running jhalfs 47 issue the following. 48 make menuconfig 49 This will create a new file named configuration but will not launch jhalfs. 44 50 45 51 4. RUNNING:: … … 159 165 Q. "It doesn't work!" 160 166 A. Yes it does, try ./lfs --help 167 Remember you must either be 'root' to run this script or have 'sudo' privileges. 161 168 162 169 Q. "It still doesn't work" … … 201 208 build method where the final build may be done on a separate machine. 202 209 210 Q. "What is the function of LUSER and LGROUP? There is no cmd line switch" 211 A. If you are running jhalfs from a low or non-priveledged account you may not 212 have the priv to create/delete accounts. These variables are adjustable 213 when invoking make. 214 make LUSER=myaccount LGROUP=mygroup 215 Then only changes to your account will be the creation of a NEW .bashrc after 216 saving your original to .bashrc.XXX 217 203 218 Q. "When I try to build 'xxx' with clfs the makefile fails at the mid-point" 204 219 A. There could be numerous reasons for the failure but the most likely reason -
common/common-functions
r725ae5a r9485eba 254 254 # 255 255 case $script_name in 256 tcl) echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;; 257 *) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;; 256 tcl) echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;; 257 linux-headers) echo $(grep "^linux-headers.*.bz2" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;; 258 *) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;; 258 259 esac 259 260 … … 310 311 @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\ 311 312 echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\ 312 chown -R lfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT 313 EOF 314 ) >> $MKFILE.tmp 315 } 316 317 318 #----------------------------------# 319 wrt_unpack_clfs() { # Unpack and set 'ROOT' var 320 #----------------------------------# 321 local FILE=$1 322 local optSAVE_PREVIOUS=$2 323 324 if [ "${optSAVE_PREVIOUS}" != "1" ]; then 325 wrt_remove_existing_dirs "$FILE" 326 fi 327 ( 328 cat << EOF 329 @\$(call unpack,$FILE) 330 @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\ 331 echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\ 332 chown -R clfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT 313 chown -R \$(LUSER) \$(MOUNT_PT)\$(SRC)/\$\$ROOT 333 314 EOF 334 315 ) >> $MKFILE.tmp … … 380 361 cat << EOF 381 362 @echo "export TEST_LOG=$TESTLOGDIR/$TESTLOGFILE" >> envars && \\ 382 su - lfs-c "echo -e '\n\`date\`\n' >$TESTLOGDIR/$TESTLOGFILE"363 su - \$(LUSER) -c "echo -e '\n\`date\`\n' >$TESTLOGDIR/$TESTLOGFILE" 383 364 EOF 384 365 ) >> $MKFILE.tmp … … 411 392 412 393 #----------------------------------# 413 wrt_ run_as_su() { # Execute script inside time { }, footer to log file394 wrt_RunAsUser() { # Execute script inside time { }, footer to log file 414 395 #----------------------------------# 415 396 local this_script=$1 … … 417 398 ( 418 399 cat << EOF 419 @( time { su - lfs -c "source /home/lfs/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\400 @( time { su - \$(LUSER) -c "source /home/\$(LUSER)/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ 420 401 echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script 421 402 EOF … … 425 406 426 407 #----------------------------------# 427 wrt_run_as_root() { # Some scripts must be run as root.. 428 #----------------------------------# 408 wrt_RunAsRoot() { # Some scripts must be run as root.. 409 #----------------------------------# 410 local ENV_MOUNT 429 411 local this_script=$1 430 412 local file=$2 431 ( 432 cat << EOF 433 @( time { export LFS=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ 413 414 case ${PROGNAME} in 415 lfs ) MOUNT_ENV="LFS" ;; 416 blfs ) MOUNT_ENV="BLFS" ;; 417 clfs ) MOUNT_ENV="CLFS" ;; 418 clfs2 ) MOUNT_ENV="CLFS" ;; 419 hlfs ) MOUNT_ENV="HLFS" ;; 420 *) echo "undefined progname $PROGNAME"; exit 1 421 esac 422 423 ( 424 cat << EOF 425 @( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ 434 426 echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script 435 427 EOF … … 439 431 440 432 #----------------------------------# 441 wrt_run_as_ clfs_su() { # Execute script inside time { }, footer to log file433 wrt_run_as_root2() { # 442 434 #----------------------------------# 443 435 local this_script=$1 … … 445 437 ( 446 438 cat << EOF 447 @( time { su - clfs -c "source /home/clfs/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\448 echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script449 EOF450 ) >> $MKFILE.tmp451 }452 453 454 #----------------------------------#455 wrt_run_as_clfs_root() { # Some scripts must be run as root..456 #----------------------------------#457 local this_script=$1458 local file=$2459 (460 cat << EOF461 @( time { export CLFS=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\462 echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script463 EOF464 ) >> $MKFILE.tmp465 }466 467 468 #----------------------------------#469 wrt_run_as_root2() { #470 #----------------------------------#471 local this_script=$1472 local file=$2473 (474 cat << EOF475 439 @( time { source envars && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ 476 440 echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \`\n" >>logs/$this_script … … 478 442 ) >> $MKFILE.tmp 479 443 } 480 481 444 482 445 … … 539 502 cat << EOF 540 503 @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\ 541 rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\504 rm -rf \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\ 542 505 if [ -e \$(MOUNT_PT)\$(SRC)/$name-build ]; then \\ 543 rm -r \$(MOUNT_PT)\$(SRC)/$name-build; \\506 rm -rf \$(MOUNT_PT)\$(SRC)/$name-build; \\ 544 507 fi; 545 508 EOF … … 555 518 cat << EOF 556 519 @ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\ 557 rm -r \$(SRC)/\$\$ROOT && \\520 rm -rf \$(SRC)/\$\$ROOT && \\ 558 521 if [ -e \$(SRC)/$name-build ]; then \\ 559 rm -r \$(SRC)/$name-build; \\522 rm -rf \$(SRC)/$name-build; \\ 560 523 fi; 561 524 EOF -
common/func_validate_configs.sh
r725ae5a r9485eba 87 87 88 88 # First internal variables, then the ones that change the book's flavour, and lastly system configuration variables 89 local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL KEYMAP PAGE TIMEZONE LANG LC_ALL "90 local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG "91 local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG "92 local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG "89 local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL KEYMAP PAGE TIMEZONE LANG LC_ALL LUSER LGROUP" 90 local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG LUSER LGROUP" 91 local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG LUSER LGROUP" 92 local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP" 93 93 94 94 local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,' … … 214 214 ARCH) validate_against_str "xx86x xx86_64x xx86_64-64x xsparcx xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xppc64x xalphax xarmx" ;; 215 215 TARGET) validate_target ;; 216 LUSER) echo -e "`eval echo $PARAM_VALS`" 217 [[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die 218 ;; 219 LGROUP) echo -e "`eval echo $PARAM_VALS`" 220 [[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die 221 ;; 216 222 GRSECURITY_HOST) validate_against_str "x0x x1x" ;; 217 223 -
master.sh
r725ae5a r9485eba 71 71 if [[ -e using_menuconfig ]]; then 72 72 source configuration 73 74 73 75 #--- Working directories 74 76 SCRIPT_ROOT=jhalfs
Note:
See TracChangeset
for help on using the changeset viewer.