Ignore:
Timestamp:
01/31/2006 03:43:13 PM (18 years ago)
Author:
Randy McMurchy <randy@…>
Branches:
10.0, 10.1, 11.0, 11.1, 11.2, 11.3, 12.0, 12.1, 6.2, 6.2.0, 6.2.0-rc1, 6.2.0-rc2, 6.3, 6.3-rc1, 6.3-rc2, 6.3-rc3, 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:
86bb9db5
Parents:
d4277d4
Message:

Minor fixes to the 'Automated Building Procedures' text, thanks Bruce

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • introduction/important/building-notes.xml

    rd4277d4 r4677cbc  
    174174
    175175    <para>This effectively makes the test suite use the responses in the file
    176     as the input to the questions. Impressive, don't you think? Occasionally
    177     you may end up doing a bit of trial and error determining the exact format
    178     of your input file for some things, but once figured out and documented you
    179     can use this to automate building the package.</para>
     176    as the input to the questions. Occasionally you may end up doing a bit of
     177    trial and error determining the exact format of your input file for some
     178    things, but once figured out and documented you can use this to automate
     179    building the package.</para>
    180180
    181181    <bridgehead renderas="sect3">Using <command>yes</command> to Automate
     
    194194    entering the following commands:</para>
    195195
    196 <screen><userinput>cat &gt; blfsyestest1 &lt;&lt; "EOF"
     196<screen><userinput>cat &gt; blfs-yes-test1 &lt;&lt; "EOF"
    197197<literal>#!/bin/bash
    198198
    199 echo -n -e \\n\\n"Please type something (or nothing) and press Enter ---> "
     199echo -n -e "\n\nPlease type something (or nothing) and press Enter ---> "
    200200
    201201read A_STRING
     
    205205fi
    206206
    207 echo -e \\n\\n$A_STRING\\n\\n</literal>
     207echo -e "\n\n$A_STRING\n\n"</literal>
    208208EOF
    209 chmod 755 blfsyestest1</userinput></screen>
    210 
    211     <para>Now run the script by issuing <command>./blfsyestest1</command> from
     209chmod 755 blfs-yes-test1</userinput></screen>
     210
     211    <para>Now run the script by issuing <command>./blfs-yes-test1</command> from
    212212    the command line. It will wait for a response, which can be anything (or
    213213    nothing) followed by the <keycap>Enter</keycap> key. After entering
     
    216216    response:</para>
    217217
    218 <screen><userinput>yes | ./blfsyestest1</userinput></screen>
     218<screen><userinput>yes | ./blfs-yes-test1</userinput></screen>
    219219
    220220    <para>Notice that piping <command>yes</command> by itself to the script
     
    222222    string of text:</para>
    223223
    224 <screen><userinput>yes 'This is some text' | ./blfsyestest1</userinput></screen>
     224<screen><userinput>yes 'This is some text' | ./blfs-yes-test1</userinput></screen>
    225225
    226226    <para>The exact string was used as the response to the script. Finally,
    227227    try it using an empty (null) string:</para>
    228228
    229 <screen><userinput>yes '' | ./blfsyestest1</userinput></screen>
     229<screen><userinput>yes '' | ./blfs-yes-test1</userinput></screen>
    230230
    231231    <para>Notice this results in passing just the press of the
     
    262262
    263263    <para>Notice that this time the command immediately returned to the shell
    264     prompt without having to page through the output. The last example will use
    265     the <command>yes</command> command in combination with output redirection
    266     to bypass having to page through the output and then providing a
    267     <keycap>y</keycap> to a prompt. This technique could be used in instances
    268     where otherwise you would have to page through the output of a file (such
    269     as a license agreement) and then answer the question of <quote>do you
    270     accept the above?</quote>. For this example, another short
    271     <application>Bash</application> script is required:</para>
    272 
    273 <screen><userinput>cat &gt; blfsyestest2 &lt;&lt; "EOF"
     264    prompt without having to page through the output. You may now remove the
     265    log file.</para>
     266
     267    <para>The last example will use the <command>yes</command> command in
     268    combination with output redirection to bypass having to page through the
     269    output and then provide a <keycap>y</keycap> to a prompt. This technique
     270    could be used in instances when otherwise you would have to page through
     271    the output of a file (such as a license agreement) and then answer the
     272    question of <quote>do you accept the above?</quote>. For this example,
     273    another short <application>Bash</application> script is required:</para>
     274
     275<screen><userinput>cat &gt; blfs-yes-test2 &lt;&lt; "EOF"
    274276<literal>#!/bin/bash
    275277
    276278ls -l /usr/bin | more
    277279
    278 echo -n -e \\n\\n"Did you enjoy reading this? (y,n) "
     280echo -n -e "\n\nDid you enjoy reading this? (y,n) "
    279281
    280282read A_STRING
     
    284286fi
    285287
    286 echo -e \\n\\n$A_STRING\\n\\n</literal>
     288echo -e "\n\n$A_STRING\n\n"</literal>
    287289EOF
    288 chmod 755 blfsyestest2</userinput></screen>
     290chmod 755 blfs-yes-test2</userinput></screen>
    289291
    290292    <para>This script can be used to simulate a program that requires you to
     
    292294    agreement before the program will install anything. First, run the script
    293295    without any automation techniques by issuing
    294     <command>./blfsyestest2</command>.</para>
     296    <command>./blfs-yes-test2</command>.</para>
    295297
    296298    <para>Now issue the following command which uses two automation techniques,
    297299    making it suitable for use in an automated build script:</para>
    298300
    299 <screen><userinput>yes | ./blfsyestest2 &gt; blfsyestest2.log 2&gt;&amp;1</userinput></screen>
    300 
    301     <para>If desired, issue <command>tail blfsyestest2.log</command> to see
     301<screen><userinput>yes | ./blfs-yes-test2 &gt; blfs-yes-test2.log 2&gt;&amp;1</userinput></screen>
     302
     303    <para>If desired, issue <command>tail blfs-yes-test2.log</command> to see
    302304    the end of the paged output, and confirmation that <keycap>y</keycap> was
    303305    passed through to the script. Once satisfied that it works as it should,
Note: See TracChangeset for help on using the changeset viewer.