Changeset 9485eba


Ignore:
Timestamp:
08/04/2006 08:06:15 PM (18 years ago)
Author:
George Boudreau <georgeb@…>
Branches:
experimental
Children:
3ba96f2
Parents:
725ae5a
Message:

Implement suggestion made byDan Nicholson for configurable user/group. Required many changes and allowed for the removal of user specific function calls. Tnx Dan

Files:
13 edited

Legend:

Unmodified
Added
Removed
  • CLFS/config

    r725ae5a r9485eba  
    66#
    77#####
     8
     9#--- Unprivileged user and group name
     10LUSER=clfs
     11LGROUP=clfs
    812
    913#--- Which target architecture you want to build for,
     
    3842#    NOTE: not all combinations are 'bootable' yet.
    3943METHOD=chroot
     44
     45#--- Unprivileged user and group name
     46LUSER=clfs
     47LGROUP=clfs
    4048
    4149#--- Location of fstab file (if empty, a template is created)
  • CLFS/master.sh

    r725ae5a r9485eba  
    4242025-addinguser:  024-creatingcrossdir
    4343        @\$(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); \\
    4747        else \\
    4848                touch user-clfs-exist; \\
    4949        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 && \\
    5454        touch \$@ && \\
    5555        echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
     
    5858026-settingenvironment:  025-addinguser
    5959        @\$(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; \\
    6262        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; \\
    6565        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/.bashrc
    80         @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 && \\
    8181        touch envars && \\
    8282        touch \$@ && \\
     
    132132    # If $pkg_tarball isn't empty, we've got a package...
    133133    #
    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}"
    137137    #
    138138    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     
    191191    # Insert instructions for unpacking the package and to set the PKGDIR variable.
    192192    #
    193     [[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball"
     193    [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
    194194    [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
    195195    #
    196     wrt_run_as_clfs_su "${this_script}" "${file}"
     196    wrt_RunAsUser "${this_script}" "${file}"
    197197    #
    198198    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     
    263263    # Insert instructions for unpacking the package and changing directories
    264264    #
    265     [[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball"
     265    [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
    266266    [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
    267267    #
    268268    # Select a script execution method
    269269    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}"    ;;
    272272      *fstab*)   if [[ -n "$FSTAB" ]]; then
    273273                   wrt_copy_fstab "${this_script}"
    274274                 else
    275                    wrt_run_as_clfs_su  "${this_script}" "${file}"
     275                   wrt_RunAsUser  "${this_script}" "${file}"
    276276                 fi
    277277         ;;
    278       *)         wrt_run_as_clfs_su  "${this_script}" "${file}"       ;;
     278      *)         wrt_RunAsUser  "${this_script}" "${file}"       ;;
    279279    esac
    280280    #
     
    333333    if [ "$pkg_tarball" != "" ] ; then
    334334      case $this_script in
    335         *util-linux)    wrt_unpack_clfs  "$pkg_tarball"  ;;
     335        *util-linux)    wrt_unpack  "$pkg_tarball"  ;;
    336336        *)              wrt_unpack2 "$pkg_tarball"  ;;
    337337      esac
     
    341341    # Select a script execution method
    342342    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}"  ;;
    346346    esac
    347347    #
     
    758758
    759759    case $this_script in
    760       *udev*) continue    ;;  # This is not a script but a commentary
     760      *udev) continue    ;;  # This is not a script but a commentary
    761761      *console*) continue ;; # Use the files that came with the bootscripts
    762762      *)  ;;
     
    774774                                  -e 's@n32@@'`
    775775    case $name in
    776       *bootscripts*) name=bootscripts-cross-lfs
    777       ;;
     776      *bootscripts*) name=bootscripts-cross-lfs ;;
     777      *udev-rules)   name=udev-cross-lfs ;;
    778778    esac
    779779
     
    10131013MOUNT_PT= $BUILDDIR
    10141014PKG_LST= $PKG_LST
     1015LUSER= $LUSER
     1016LGROUP= $LGROUP
    10151017
    10161018include makefile-functions
     
    10651067clean-chapter2:
    10661068        -if [ ! -f user-clfs-exist ]; then \\
    1067                 userdel clfs; \\
    1068                 rm -rf /home/clfs; \\
     1069                userdel \$(LUSER); \\
     1070                rm -rf /home/\$(LUSER); \\
    10691071        fi;
    10701072        rm -rf \$(MOUNT_PT)/tools
     
    10931095restore-clfs-env:
    10941096        @\$(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; \\
    10971099        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; \\
    11001102        fi;
    1101         @chown clfs:clfs /home/clfs/.bash* && \\
     1103        @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
    11021104        touch \$@ && \\
    11031105        echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
     
    11111113        @-umount \$(MOUNT_PT)/proc
    11121114        @-if [ ! -f user-clfs-exist ]; then \\
    1113                 userdel clfs; \\
    1114                 rm -rf /home/clfs; \\
     1115                userdel \$(LUSER); \\
     1116                rm -rf /home/\$(LUSER); \\
    11151117        fi;
    11161118
     
    11471149clean-jhalfs:
    11481150        -if [ ! -f user-clfs-exist ]; then \\
    1149                 userdel clfs; \\
    1150                 rm -rf /home/clfs; \\
     1151                userdel \$(LUSER); \\
     1152                rm -rf /home/\$(LUSER); \\
    11511153        fi;
    11521154        rm -rf \$(MOUNT_PT)/tools
     
    11781180restore-clfs-env:
    11791181        @\$(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; \\
    11821184        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; \\
    11851187        fi;
    1186         @chown clfs:clfs /home/clfs/.bash* && \\
     1188        @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
    11871189        touch \$@ && \\
    11881190        echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
  • CLFS2/config

    r725ae5a r9485eba  
    66#
    77#####
     8#--- Unprivileged user and group name
     9LUSER=clfs
     10LGROUP=clfs
     11
    812
    913#--- Which target architecture you want to build for,
     
    2125#--------------------------------
    2226# >>>> MULTILIB 32/64 <<<<
     27
     28#--- Unprivileged user and group name
     29LUSER=clfs
     30LGROUP=clfs
    2331
    2432#--- Location of fstab file (if empty, a template is created)
  • CLFS2/master.sh

    r725ae5a r9485eba  
    55###          FUNCTIONS          ###
    66###################################
    7 
    8 #----------------------------------#
    9 wrt_ExecuteAsUser() {              # Execute the file ($3) under the users account ($1), log in $2
    10 #----------------------------------#
    11   local this_user=$1
    12   local this_script=$2
    13   local file=$3
    14 (
    15 cat << EOF
    16         @( 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_script
    18 EOF
    19 ) >> $MKFILE.tmp
    20 }
    21 
    22 
    23 #----------------------------------#
    24 wrt_Unpack_SetOwner() {            # Unpack and set owner. Assign 'ROOT' var
    25 #----------------------------------#
    26   local USER_ACCT=$1
    27   local FILE=$2
    28   local optSAVE_PREVIOUS=$3
    29 
    30   if [ "${optSAVE_PREVIOUS}" != "1" ]; then
    31     wrt_remove_existing_dirs "$FILE"
    32   fi
    33 (
    34 cat << EOF
    35         @\$(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)/\$\$ROOT
    39 EOF
    40 ) >> $MKFILE.tmp
    41 }
    427
    438
     
    6833025-addinguser:  023-creatingtoolsdir
    6934        @\$(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); \\
    7338        else \\
    7439                touch user-clfs-exist; \\
    7540        fi;
    76         @chown clfs \$(MOUNT_PT) && \\
    77         chown clfs \$(MOUNT_PT)/tools && \\
    78         chown clfs \$(MOUNT_PT)/sources
     41        @chown \$(LUSER) \$(MOUNT_PT) && \\
     42        chown \$(LUSER) \$(MOUNT_PT)/tools && \\
     43        chown \$(LUSER) \$(MOUNT_PT)/sources
    7944        @touch \$@ && \\
    8045        echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
     
    8348026-settingenvironment:  025-addinguser
    8449        @\$(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/.bashrc
    105         @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 && \\
    10671        touch envars
    10772        @touch \$@ && \\
     
    154119        @touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp}
    155120        @chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog
    156         @chown -R clfs \$(MOUNT_PT)
     121        @chown -R \$(LUSER) \$(MOUNT_PT)
    157122
    158123        @touch \$@ && \\
     
    200165    esac
    201166    pkg_tarball=$(get_package_tarball_name $name)
    202 
    203167    #--------------------------------------------------------------------#
    204168    #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     
    211175    # If $pkg_tarball isn't empty, we've got a package...
    212176    if [ "$pkg_tarball" != "" ] ; then
    213        wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
     177       wrt_unpack "$pkg_tarball"
    214178       # If using optimizations, write the instructions
    215179       [[ "$OPTIMIZE" != "0" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
    216180    fi
    217181    #
    218     wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
     182    wrt_RunAsUser "${this_script}" "${file}"
    219183    #
    220184    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     
    309273    # If $pkg_tarball isn't empty, we've got a package...
    310274    if [ "$pkg_tarball" != "" ] ; then
    311       wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
     275      wrt_unpack "$pkg_tarball"
    312276      # If using optimizations, write the instructions
    313277      [[ "$OPTIMIZE" != "0" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
    314278    fi
    315279    #
    316     wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
     280    wrt_RunAsUser "${this_script}" "${file}"
    317281    #
    318282    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     
    375339    #
    376340    # 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}"
    380344    #
    381345    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     
    437401    #
    438402    # 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"
    440404    #
    441405    # Select a script execution method
     
    444408                  wrt_copy_fstab "${this_script}"
    445409                else
    446                   wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
     410                  wrt_RunAsUser "${this_script}" "${file}"
    447411                fi
    448412          ;;
    449       *)  wrt_ExecuteAsUser "clfs"  "${this_script}" "${file}"
     413      *chowning)  wrt_RunAsRoot "${this_script}" "${file}"
     414          ;;
     415              *)  wrt_RunAsUser "${this_script}" "${file}"
    450416          ;;
    451417    esac
     
    496462MOUNT_PT= $BUILDDIR
    497463PKG_LST= $PKG_LST
     464LUSER= $LUSER
     465LGROUP= $LGROUP
    498466
    499467include makefile-functions
     
    529497restore-clfs-env:
    530498        @\$(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* && \\
    538506        touch \$@ && \\
    539507        echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
     
    542510do-housekeeping:
    543511        @-if [ ! -f user-clfs-exist ]; then \\
    544                 userdel clfs; \\
    545                 rm -rf /home/clfs; \\
     512                userdel \$(LUSER); \\
     513                rm -rf /home/\$(LUSER); \\
    546514        fi;
    547515
  • Config.in

    r725ae5a r9485eba  
    3030
    3131
     32
    3233#--- Book version
    3334#menu   "Book Version"         
     
    5960                        #
    6061#endmenu
    61                
    6262#-----------------------
     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------------------------
    63111       
    64112comment "--------CLFS specific params---------"
  • HLFS/config

    r725ae5a r9485eba  
    77#####
    88
     9#--- Unprivileged user and group name
     10LUSER=hlfs
     11LGROUP=hlfs
     12
    913#--- Which library model to use uclibc/glibc
    1014MODEL=glibc
     
    1216#--- The host system has grsecurity options enabled? 0(no)/1(yes)
    1317GRSECURITY_HOST=0
     18
     19#--- Unprivileged user and group name
     20LUSER=hlfs
     21LGROUP=hlfs
    1422
    1523#--- Location of fstab file (if empty, a template is created)
  • HLFS/master.sh

    r725ae5a r9485eba  
    77###          FUNCTIONS          ###
    88###################################
    9 
    10 #----------------------------------#
    11 wrt_ExecuteAsUser() {              # Execute the file ($3) under the users account ($1), log in $2
    12 #----------------------------------#
    13   local this_user=$1
    14   local this_script=$2
    15   local file=$3
    16 
    17 (
    18 cat << EOF
    19         @( 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_script
    21 EOF
    22 ) >> $MKFILE.tmp
    23 }
    24 
    25 
    26 #----------------------------------#
    27 wrt_Unpack_SetOwner() {            # Unpack and set owner. Assign 'ROOT' var
    28 #----------------------------------#
    29   local USER_ACCT=$1
    30   local FILE=$2
    31   local optSAVE_PREVIOUS=$3
    32 
    33   if [ "${optSAVE_PREVIOUS}" != "1" ]; then
    34     wrt_remove_existing_dirs "$FILE"
    35   fi
    36 (
    37 cat << EOF
    38         @\$(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)/\$\$ROOT
    42 EOF
    43 ) >> $MKFILE.tmp
    44 }
    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=$2
    51   local file=$3
    52 
    53 (
    54 cat << EOF
    55         @( 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_script
    57 EOF
    58 ) >> $MKFILE.tmp
    59 }
    60 
    619
    6210#----------------------------#
     
    8634EOF
    8735) >> $MKFILE.tmp
    88       wrt_ExecuteAsUser "hlfs" "$toolchain" "$this_script"
     36      wrt_RunAsUser "$toolchain" "$this_script"
    8937      ;;
    9038  esac
    9139  #
    92   # Safe method to remove packages unpacked outside the toolchain
     40  # Safe method to remove packages unpacked while inside the toolchain script
    9341  pkg_tarball=$(get_package_tarball_name "binutils")
    9442  wrt_remove_existing_dirs  "$pkg_tarball"
     
    14189021-addinguser:  020-creatingtoolsdir
    14290        @\$(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); \\
    14694        else \\
    14795                touch user-hlfs-exist; \\
    14896        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 && \\
    15199        touch \$@ && \\
    152100        echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
     
    155103022-settingenvironment:  021-addinguser
    156104        @\$(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 && \\
    175123        touch envars && \\
    176124        touch \$@ && \\
     
    247195    if [ "$pkg_tarball" != "" ] ; then
    248196      # Insert instructions for unpacking the package and to set the PKGDIR variable.
    249       wrt_Unpack_SetOwner "hlfs" "$pkg_tarball"
     197      wrt_unpack "$pkg_tarball"
    250198      # If using optimizations, write the instructions
    251199      [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     
    253201    # Insert date and disk usage at the top of the log file, the script run
    254202    # 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}"
    256204
    257205    # Remove the build directory(ies) except if the package build fails
     
    380328    case "${this_script}" in
    381329      *kernfs*)
    382         wrt_RunAsRoot "hlfs" "${this_script}" "${file}"
     330        wrt_RunAsRoot "${this_script}" "${file}"
    383331        ;;
    384332      *)   # The rest of Chapter06
     
    522470MOUNT_PT= $BUILDDIR
    523471PKG_LST= $PKG_LST
     472LUSER= $LUSER
     473LGROUP= $LGROUP
    524474
    525475include makefile-functions
     
    569519clean-chapter3:
    570520        -if [ ! -f user-hlfs-exist ]; then \\
    571                 userdel hlfs; \\
    572                 rm -rf /home/hlfs; \\
     521                userdel \$(LUSER); \\
     522                rm -rf /home/\$(LUSER); \\
    573523        fi;
    574524        rm -rf \$(MOUNT_PT)/tools
     
    598548restore-hlfs-env:
    599549        @\$(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* && \\
    607557        touch \$@ && \\
    608558        echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
     
    616566        @-umount \$(MOUNT_PT)/proc
    617567        @-if [ ! -f user-hlfs-exist ]; then \\
    618                 userdel hlfs; \\
    619                 rm -rf /home/hlfs; \\
     568                userdel \$(LUSER); \\
     569                rm -rf /home/\$(LUSER); \\
    620570        fi;
    621571
  • LFS/config

    r725ae5a r9485eba  
    66#
    77#####
     8
     9#--- Unprivileged user and group name
     10LUSER=lfs
     11LGROUP=lfs
    812
    913#--- Location of fstab file (if empty, a template is created)
  • LFS/master.sh

    r725ae5a r9485eba  
    3030021-addinguser:  020-creatingtoolsdir
    3131        @\$(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); \\
    3535        else \\
    3636                touch user-lfs-exist; \\
    3737        fi;
    38         @chown lfs \$(MOUNT_PT)/tools && \\
     38        @chown \$(LUSER) \$(MOUNT_PT)/tools && \\
    3939        chmod a+wt \$(MOUNT_PT)/sources && \\
    4040        touch \$@ && \\
     
    4444022-settingenvironment:  021-addinguser
    4545        @\$(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 && \\
    6060        touch envars && \\
    6161        touch \$@ && \\
     
    123123    # The changingowner script must be run as root.
    124124    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" ;;
    127127    esac
    128128
     
    235235    # and not to use chroot.
    236236    case "${this_script}" in
    237       *kernfs)  wrt_run_as_root    "${this_script}" "$file" ;;
     237      *kernfs)  wrt_RunAsRoot    "${this_script}" "$file" ;;
    238238      *)        wrt_run_as_chroot1 "${this_script}" "$file" ;;
    239239    esac
     
    369369MOUNT_PT= $BUILDDIR
    370370PKG_LST= $PKG_LST
     371LUSER= $LUSER
     372LGROUP= $LGROUP
    371373
    372374include makefile-functions
     
    410412clean-chapter4:
    411413        -if [ ! -f user-lfs-exist ]; then \\
    412                 userdel lfs; \\
    413                 rm -rf /home/lfs; \\
     414                userdel \$(LUSER); \\
     415                rm -rf /home/\$(LUSER); \\
    414416        fi;
    415417        rm -rf \$(MOUNT_PT)/tools
     
    439441restore-lfs-env:
    440442        @\$(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* && \\
    448450        touch \$@ && \\
    449451        echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
     
    457459        @-umount \$(MOUNT_PT)/dev
    458460        @-if [ ! -f user-lfs-exist ]; then \\
    459                 userdel lfs; \\
    460                 rm -rf /home/lfs; \\
     461                userdel \$(LUSER); \\
     462                rm -rf /home/\$(LUSER); \\
    461463        fi;
    462464
  • README

    r725ae5a r9485eba  
    3333     
    3434     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.
    4143     ..note.. The generated file <configuration> is only used by jhalfs if you
    4244     run jhalfs via make otherwise it is ignored.
    4345     
     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.
    4450   
    45514. RUNNING::
     
    159165    Q. "It doesn't work!"
    160166    A. Yes it does, try ./lfs --help
     167       Remember you must either be 'root' to run this script or have 'sudo' privileges.
    161168
    162169    Q. "It still doesn't work"
     
    201208       build method where the final build may be done on a separate machine.
    202209
     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   
    203218    Q. "When I try to build 'xxx' with clfs the makefile fails at the mid-point"
    204219    A. There could be numerous reasons for the failure but the most likely reason
  • common/common-functions

    r725ae5a r9485eba  
    254254   #
    255255   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 ) ;;
    258259   esac
    259260
     
    310311        @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
    311312        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
    333314EOF
    334315) >> $MKFILE.tmp
     
    380361cat  << EOF
    381362        @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"
    383364EOF
    384365) >> $MKFILE.tmp
     
    411392
    412393#----------------------------------#
    413 wrt_run_as_su() {                  # Execute script inside time { }, footer to log file
     394wrt_RunAsUser() {                  # Execute script inside time { }, footer to log file
    414395#----------------------------------#
    415396  local this_script=$1
     
    417398(
    418399cat << 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 && \\
    420401        echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
    421402EOF
     
    425406
    426407#----------------------------------#
    427 wrt_run_as_root() {                # Some scripts must be run as root..
    428 #----------------------------------#
     408wrt_RunAsRoot() {                  # Some scripts must be run as root..
     409#----------------------------------#
     410  local ENV_MOUNT
    429411  local this_script=$1
    430412  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(
     424cat << EOF
     425        @( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
    434426        echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
    435427EOF
     
    439431
    440432#----------------------------------#
    441 wrt_run_as_clfs_su() {             # Execute script inside time { }, footer to log file
     433wrt_run_as_root2() {               #
    442434#----------------------------------#
    443435  local this_script=$1
     
    445437(
    446438cat << 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_script
    449 EOF
    450 ) >> $MKFILE.tmp
    451 }
    452 
    453 
    454 #----------------------------------#
    455 wrt_run_as_clfs_root() {           # Some scripts must be run as root..
    456 #----------------------------------#
    457   local this_script=$1
    458   local file=$2
    459 (
    460 cat << EOF
    461         @( 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_script
    463 EOF
    464 ) >> $MKFILE.tmp
    465 }
    466 
    467 
    468 #----------------------------------#
    469 wrt_run_as_root2() {               #
    470 #----------------------------------#
    471   local this_script=$1
    472   local file=$2
    473 (
    474 cat << EOF
    475439        @( time { source envars && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
    476440        echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \`\n" >>logs/$this_script
     
    478442) >> $MKFILE.tmp
    479443}
    480 
    481444
    482445
     
    539502cat << EOF
    540503        @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 && \\
    542505        if [ -e \$(MOUNT_PT)\$(SRC)/$name-build ]; then \\
    543                 rm -r \$(MOUNT_PT)\$(SRC)/$name-build; \\
     506                rm -rf \$(MOUNT_PT)\$(SRC)/$name-build; \\
    544507        fi;
    545508EOF
     
    555518cat << EOF
    556519        @ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
    557         rm -r \$(SRC)/\$\$ROOT && \\
     520        rm -rf \$(SRC)/\$\$ROOT && \\
    558521        if [ -e \$(SRC)/$name-build ]; then \\
    559                 rm -r \$(SRC)/$name-build; \\
     522                rm -rf \$(SRC)/$name-build; \\
    560523        fi;
    561524EOF
  • common/func_validate_configs.sh

    r725ae5a r9485eba  
    8787
    8888  # 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"
    9393
    9494  local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,'
     
    214214      ARCH)       validate_against_str "xx86x xx86_64x xx86_64-64x xsparcx xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xppc64x xalphax xarmx" ;;
    215215      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                  ;;
    216222      GRSECURITY_HOST)  validate_against_str "x0x x1x" ;;
    217223
  • master.sh

    r725ae5a r9485eba  
    7171if [[ -e using_menuconfig ]]; then
    7272  source configuration
     73
     74
    7375        #--- Working directories
    7476  SCRIPT_ROOT=jhalfs
Note: See TracChangeset for help on using the changeset viewer.