Changeset 9485eba for CLFS


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

Location:
CLFS
Files:
2 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 && \\
Note: See TracChangeset for help on using the changeset viewer.