Changeset ba58642


Ignore:
Timestamp:
10/10/2012 09:35:16 PM (12 years ago)
Author:
Bruce Dubbs <bdubbs@…>
Branches:
10.0, 10.1, 11.0, 11.1, 11.2, 11.3, 12.0, 12.1, 7.10, 7.4, 7.5, 7.6, 7.6-blfs, 7.6-systemd, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, basic, bdubbs/svn, elogind, gnome, kde5-13430, kde5-14269, kde5-14686, kea, ken/TL2024, ken/inkscape-core-mods, ken/tuningfonts, krejzi/svn, lazarus, lxqt, nosym, perl-modules, plabs/newcss, plabs/python-mods, python3.11, qt5new, rahul/power-profiles-daemon, renodr/vulkan-addition, systemd-11177, systemd-13485, trunk, upgradedb, xry111/intltool, xry111/llvm18, xry111/soup3, xry111/test-20220226, xry111/xf86-video-removal
Children:
ec33cf5
Parents:
68a5e1d0
Message:

Update description of how to execute a command as root in a small script.
Used in several xorg sections.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@10728 af4574ff-66df-0310-9fd7-8a98e5e911e0

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • general.ent

    r68a5e1d0 rba58642  
    117117<!-- End special entities about LFS compatibility -->
    118118
    119 <!ENTITY as_root              "<note><para>When installing multiple packages in
    120                               a script, the installation needs to be done as
    121                               the root user. There are three general options
    122                               that can be used to do this:</para>
    123 
    124                               <orderedlist>
    125                               <listitem><para>Run the entire script as the root
    126                               user (not recommended).</para></listitem>
    127 
    128                               <listitem><para>Use the '<command>sudo</command>'
    129                               command from the <xref linkend='sudo'/>
    130                               package.</para></listitem>
    131 
    132                               <listitem><para>Use '<command>su -c</command>'
    133                               which will ask for the root password for every
    134                               iteration of the loop.</para></listitem>
    135                               </orderedlist>
    136 
    137                               <para>Select a preferred method and export a
    138                               variable <parameter>AS_ROOT</parameter> with the
    139                               following command replacing
    140                               <parameter>&lt;as_root&gt;</parameter> with the
    141                               selected command (unset or use an empty variable
    142                               if you intend to run the entire loop as the
    143                               root user):</para>
    144 
    145                               <screen><userinput>export AS_ROOT='<replaceable>&lt;as_root&gt;</replaceable>'</userinput></screen>
    146                               </note>">
     119<!ENTITY as_root "<note><para>When installing multiple packages in a script,
     120  the installation needs to be done as the root user. There are three general
     121  options that can be used to do this:</para>
     122
     123  <orderedlist>
     124
     125  <listitem><para>Run the entire script as the root user (not
     126  recommended).</para></listitem>
     127
     128  <listitem><para>Use the <command>sudo</command> command from the <xref
     129  linkend='sudo'/> package.</para></listitem>
     130
     131  <listitem><para>Use <command>su -c &quot;command arguments&quot;</command>
     132  (quotes required) which will ask for the root  password for every iteration
     133  of the loop.</para></listitem>
     134 
     135  </orderedlist>
     136
     137  <para>One way to handle this situation is to create a short
     138  <command>bash</command> function that automatically selects the appropriate
     139  method.  Once the command is set in the environment, it does not need to be
     140  set again.</para>
     141 
     142  <screen><userinput>as_root()
     143{
     144  if   [ $EUID = 0 ];        then $*
     145  elif [ -x /usr/bin/sudo ]; then sudo $*
     146  else                            su -c \\&quot;$*\\&quot;
     147  fi
     148}
     149
     150export -f as_root</userinput></screen>
     151</note>">
    147152
    148153<!ENTITY not-katamari         "<para>This package is not a part of the Xorg
  • introduction/welcome/changelog.xml

    r68a5e1d0 rba58642  
    4848      <itemizedlist>
    4949        <listitem>
    50           <para>[krejzi] - Fix Freeglut build with
    51           recent MesaLib.</para>
    52         </listitem>
    53         <listitem>
    54           <para>[krejzi] - Updated all of Xorg Drivers
    55           to newer available versions.</para>
     50          <para>[bdubbs] - Update description of how to execute a
     51          command as root in a small script.  Useful in several
     52          xorg sections.</para>
     53        </listitem>
     54        <listitem>
     55          <para>[krejzi] - Fix Freeglut build with recent MesaLib.</para>
     56        </listitem>
     57        <listitem>
     58          <para>[krejzi] - Updated all of Xorg Drivers to newer available
     59          versions.</para>
    5660        </listitem>
    5761      </itemizedlist>
  • x/installing/x7app.xml

    r68a5e1d0 rba58642  
    259259  ./configure $XORG_CONFIG
    260260  make
    261   $AS_ROOT "make install"
     261  as_root make install
    262262  popd
    263263  rm -r $packagedir
  • x/installing/x7font.xml

    r68a5e1d0 rba58642  
    250250  ./configure $XORG_CONFIG
    251251  make
    252   $AS_ROOT "make install"
     252  as_root make install
    253253  popd
    254254  rm -r $packagedir
  • x/installing/x7lib.xml

    r68a5e1d0 rba58642  
    249249  esac
    250250  make
    251   $AS_ROOT "make install"
     251  as_root make install
    252252  popd
    253253  rm -r $packagedir
    254   $AS_ROOT "/sbin/ldconfig"
     254  as_root /sbin/ldconfig
    255255done</userinput></screen>
    256256
  • x/installing/x7proto.xml

    r68a5e1d0 rba58642  
    217217  pushd $packagedir
    218218  ./configure $XORG_CONFIG
    219   $AS_ROOT "make install"
     219  as_root make install
    220220  popd
    221221  rm -r $packagedir
Note: See TracChangeset for help on using the changeset viewer.