https://fedoraproject.org/w/index.php?title=Anaconda/KsExample&feed=atom&action=history
Anaconda/KsExample - Revision history
2024-03-19T02:35:12Z
Revision history for this page on the wiki
MediaWiki 1.39.4
https://fedoraproject.org/w/index.php?title=Anaconda/KsExample&diff=3213&oldid=prev
Ravidiip: 1 revision(s)
2008-05-24T16:26:50Z
<p>1 revision(s)</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<tr class="diff-title" lang="en">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 16:26, 24 May 2008</td>
</tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>
Ravidiip
https://fedoraproject.org/w/index.php?title=Anaconda/KsExample&diff=3212&oldid=prev
fp-wiki>ImportUser: Imported from MoinMoin
2008-05-24T14:13:02Z
<p>Imported from MoinMoin</p>
<p><b>New page</b></p><div><!-- page was renamed from AnacondaKsExample<br />
--><br />
= An example for customized user interaction in the %post section: =<br />
<br />
In order to allow user interaction in the %post section a switch of the virtual terminal has to occur. This is done with the following lines right after the *%post%* line and before any other script starts.<br />
<br />
_exec < /dev/tty3 > /dev/tty3_<br />
_chvt 3_<br />
<br />
Once the script is finished the virtual terminal needs to be switched back to where the original Anaconda process runs. This is accomplished by adding a _chvt 3_ line to the end of the *%post%* section.<br />
<br />
The following is an example of a *%post%* script that will first ask to enter a new root password, then it will ask to verify the new root password. If the two entries match it asks to enter a user name, then a "real user name" and finally the script asks for a user password and a verification entry. If the two passwords match the script is finished and is returned to the Anaconda process where the installaion process continues.<br />
<br />
<pre><br />
---<br />
*Example %post section*<br />
---<br />
%post<br />
exec < /dev/tty3 > /dev/tty3<br />
chvt 3<br />
<br />
<!--##################################################################################################################################################################<br />
--><br />
<!--##################################################################################################################################################################<br />
--><br />
<br />
PASSWORD="&*UY^&^YI"<br />
PASSWORD_CHECK=1<br />
<br />
until [ "$PASSWORD" = "$PASSWORD_CHECK" ] <br />
do<br />
if [ $PASSWORD = "&*UY^&^YI" ] ; then<br />
<br />
dialog --title "Enter root (Administrator) Password" --backtitle "MyDistro (C) 2003 MyDistro" --no-cancel --passwordbox "Enter a root (Administrator) password between 6 and 8 characters" 8 60 2>/tmp/passwd.$$<br />
<br />
SEL=$?<br />
<br />
NA5=<code>cat /tmp/passwd.$$</code><br />
case $SEL in<br />
0) PASSWORD=$NA5;;<br />
1) echo "Cancel is Pressed" ;;<br />
255) echo "[ESCAPE] key pressed" ;;<br />
esac<br />
<br />
rm -f /tmp/passwd.$$<br />
<br />
else<br />
<br />
dialog --title "Passwords do not match" --backtitle "MyDistro (C) 2003 MyDistro" --msgbox "The passwords you entered do not match. Please re-enter passwords" 6 50<br />
<br />
dialog --title "Enter root (Administrator) Password" --backtitle "MyDistro (C) 2003 MyDistro" --no-cancel --passwordbox "Enter a root (Administrator) password between 6 and 8 characters" 8 60 2>/tmp/passwd.$$<br />
<br />
SEL=$?<br />
<br />
NA5=<code>cat /tmp/passwd.$$</code><br />
case $SEL in<br />
0) PASSWORD=$NA5;;<br />
1) echo "Cancel is Pressed" ;;<br />
255) echo "[ESCAPE] key pressed" ;;<br />
esac<br />
<br />
rm -f /tmp/passwd.$$<br />
<br />
fi<br />
<br />
dialog --title "Re-enter root (Administrator) Password" --backtitle "MyDistro (C) 2003 MyDistro" --no-cancel --passwordbox "Please re-enter the root (Administrator) password" 8 60 2>/tmp/passwd.$$<br />
<br />
SEL=$?<br />
<br />
NA4=<code>cat /tmp/passwd.$$</code><br />
case $SEL in<br />
0) PASSWORD_CHECK=$NA4;;<br />
1) echo "Cancel is Pressed" ;;<br />
255) echo "[ESCAPE] key pressed" ;;<br />
esac<br />
<br />
rm -f /tmp/passwd.$$<br />
<br />
done<br />
<br />
echo $NA4 | passwd --stdin root >/dev/null 2>&1<br />
<br />
<!--##################################################################################################################################################################<br />
--><br />
<br />
<!--##################################################################################################################################################################<br />
--><br />
<!--##################################################################################################################################################################<br />
--><br />
<br />
dialog --title "Add Username" --backtitle "MyDistro (C) 2003 MyDistro" --no-cancel --inputbox "Enter an easy to remember Username please" 8 60 2>/tmp/usrname.$$<br />
<br />
SEL=$?<br />
<br />
NA=<code>cat /tmp/usrname.$$</code><br />
case $SEL in<br />
0) useradd $NA >/dev/null 2>&1 ;;<br />
1) echo "Cancel is Pressed" ;;<br />
255) echo "[ESCAPE] key pressed" ;;<br />
esac<br />
<br />
rm -f /tmp/usrname.$$<br />
<br />
<!--##################################################################################################################################################################<br />
--><br />
<br />
<!--##################################################################################################################################################################<br />
--><br />
<!--##################################################################################################################################################################<br />
--><br />
<br />
dialog --title "Enter Name" --backtitle "MyDistro (C) 2003 MyDistro" --no-cancel --inputbox "Please enter your real name(first and last)" 8 60 2>/tmp/name.$$<br />
<br />
SEL=$?<br />
<br />
NA2=<code>cat /tmp/name.$$</code><br />
case $SEL in<br />
0) chfn -f "$NA2" $NA >/dev/null 2>&1 ;;<br />
1) echo "Cancel is Pressed" ;;<br />
255) echo "[ESCAPE] key pressed" ;;<br />
esac<br />
<br />
rm -f /tmp/name.$$<br />
<br />
<!--##################################################################################################################################################################<br />
--><br />
<br />
<!--##################################################################################################################################################################<br />
--><br />
<!--##################################################################################################################################################################<br />
--><br />
<br />
PASSWORD="&*UY^&^YY"<br />
PASSWORD_CHECK=1<br />
until [ "$PASSWORD" = "$PASSWORD_CHECK" ] <br />
do<br />
if [ $PASSWORD = "&*UY^&^YY" ] ; then<br />
<br />
dialog --title "Enter Password" --backtitle "MyDistro (C) 2003 MyDistro" --no-cancel --passwordbox "Enter a password between 6 and 8 characters" 8 60 2>/tmp/passwd.$$<br />
<br />
SEL=$?<br />
<br />
NA1=<code>cat /tmp/passwd.$$</code><br />
case $SEL in<br />
0) PASSWORD=$NA1;;<br />
1) echo "Cancel is Pressed" ;;<br />
255) echo "[ESCAPE] key pressed" ;;<br />
esac<br />
<br />
rm -f /tmp/passwd.$$<br />
<br />
else<br />
<br />
dialog --title "Password's do not match" --backtitle "MyDistro (C) 2003 MyDistro" --msgbox "The passwords you entered do not match. Please re-enter passwords" 6 50<br />
<br />
dialog --title "Enter Password" --backtitle "MyDistro (C) 2003 MyDistro" --no-cancel --passwordbox "Enter a password between 6 and 8 characters" 8 60 2>/tmp/passwd.$$<br />
<br />
SEL=$?<br />
<br />
NA1=<code>cat /tmp/passwd.$$</code><br />
case $SEL in<br />
0) PASSWORD=$NA1;;<br />
1) echo "Cancel is Pressed" ;;<br />
255) echo "[ESCAPE] key pressed" ;;<br />
esac<br />
<br />
rm -f /tmp/passwd.$$<br />
<br />
fi<br />
<br />
dialog --title "Re-enter Password" --backtitle "MyDistro (C) 2003 MyDistro" --no-cancel --passwordbox "Please re-enter your password" 8 60 2>/tmp/passwd.$$<br />
<br />
SEL=$?<br />
<br />
NA3=<code>cat /tmp/passwd.$$</code><br />
case $SEL in<br />
0) PASSWORD_CHECK=$NA3;;<br />
1) echo "Cancel is Pressed" ;;<br />
255) echo "[ESCAPE] key pressed" ;;<br />
esac<br />
<br />
rm -f /tmp/passwd.$$<br />
<br />
done<br />
<br />
echo $NA3 | passwd --stdin $NA >/dev/null 2>&1<br />
<br />
<!--##################################################################################################################################################################<br />
--><br />
<br />
<!--##################################################################################################################################################################<br />
--><br />
<!--##################################################################################################################################################################<br />
--><br />
<br />
dialog --title "Thank you" --backtitle "MyDistro (C) 2003 MyDistro" --msgbox "Thank you for choosing and installing MyDistro. Please press <ENTER> to reboot system and start MyDistro. Please remove any floppy disks and/or CD-ROMS from their respective drives." 9 50<br />
<br />
<!--##################################################################################################################################################################<br />
--><br />
<br />
chvt 3<br />
<br />
</pre><br />
----<br />
[[Category:Anaconda]]</div>
fp-wiki>ImportUser