⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makeworld.html

📁 FreeBSD操作系统的详细使用手册
💻 HTML
📖 第 1 页 / 共 4 页
字号:
both files. You can now merge them by reviewing both files side by side on the screen,and choosing parts from both to create a finished product. When the files are comparedside by side, the <b class="KEYCAP">l</b> key will select the left contents and the <bclass="KEYCAP">r</b> key will select contents from your right. The final output will be afile consisting of both parts, which can then be installed. This option is customarilyused for files where settings have been modified by the user.</p><p>Choosing to view the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=diff&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">diff</span>(1)</span></a> results againwill show you the file differences just like <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=mergemaster&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">mergemaster</span>(8)</span></a> didbefore prompting you for an option.</p><p>After <a href="http://www.FreeBSD.org/cgi/man.cgi?query=mergemaster&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">mergemaster</span>(8)</span></a> is donewith the system files you will be prompted for other options. <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=mergemaster&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">mergemaster</span>(8)</span></a> may askif you want to rebuild the password file and/or run <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=MAKEDEV&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">MAKEDEV</span>(8)</span></a> if you runa FreeBSD version prior to 5.0, and will finish up with an option to remove left-overtemporary files.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN27941" name="AEN27941">19.4.11.2 Manual Update</a></h3><p>If you wish to do the update manually, however, you cannot just copy over the filesfrom <tt class="FILENAME">/usr/src/etc</tt> to <tt class="FILENAME">/etc</tt> and have itwork. Some of these files must be ``installed'' first. This is because the <ttclass="FILENAME">/usr/src/etc</tt> directory <span class="emphasis"><iclass="EMPHASIS">is not</i></span> a copy of what your <tt class="FILENAME">/etc</tt>directory should look like. In addition, there are files that should be in <ttclass="FILENAME">/etc</tt> that are not in <tt class="FILENAME">/usr/src/etc</tt>.</p><p>If you are using <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=mergemaster&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">mergemaster</span>(8)</span></a> (asrecommended), you can skip forward to the <a href="makeworld.html#UPDATE-DEV">nextsection</a>.</p><p>The simplest way to do this by hand is to install the files into a new directory, andthen work through them looking for differences.</p><div class="WARNING"><blockquote class="WARNING"><p><b>Backup Your Existing <tt class="FILENAME">/etc</tt>:</b> Although, in theory,nothing is going to touch this directory automatically, it is always better to be sure.So copy your existing <tt class="FILENAME">/etc</tt> directory somewhere safe. Somethinglike:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">cp -Rp /etc /etc.old</kbd></pre><p><var class="OPTION">-R</var> does a recursive copy, <var class="OPTION">-p</var>preserves times, ownerships on files and suchlike.</p></blockquote></div><p>You need to build a dummy set of directories to install the new <ttclass="FILENAME">/etc</tt> and other files into. <tt class="FILENAME">/var/tmp/root</tt>is a reasonable choice, and there are a number of subdirectories required under this aswell.</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">mkdir /var/tmp/root</kbd><samp class="PROMPT">#</samp> <kbd class="USERINPUT">cd /usr/src/etc</kbd><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">make DESTDIR=/var/tmp/root distrib-dirs distribution</kbd></pre><p>This will build the necessary directory structure and install the files. A lot of thesubdirectories that have been created under <tt class="FILENAME">/var/tmp/root</tt> areempty and should be deleted. The simplest way to do this is to:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">cd /var/tmp/root</kbd><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">find -d . -type d | xargs rmdir 2&gt;/dev/null</kbd></pre><p>This will remove all empty directories. (Standard error is redirected to <ttclass="FILENAME">/dev/null</tt> to prevent the warnings about the directories that arenot empty.)</p><p><tt class="FILENAME">/var/tmp/root</tt> now contains all the files that should beplaced in appropriate locations below <tt class="FILENAME">/</tt>. You now have to gothrough each of these files, determining how they differ with your existing files.</p><p>Note that some of the files that will have been installed in <ttclass="FILENAME">/var/tmp/root</tt> have a leading ``.''. At the time of writing the onlyfiles like this are shell startup files in <tt class="FILENAME">/var/tmp/root/</tt> and<tt class="FILENAME">/var/tmp/root/root/</tt>, although there may be others (depending onwhen you are reading this). Make sure you use <tt class="COMMAND">ls -a</tt> to catchthem.</p><p>The simplest way to do this is to use <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=diff&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">diff</span>(1)</span></a> to compare thetwo files:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">diff /etc/shells /var/tmp/root/etc/shells</kbd></pre><p>This will show you the differences between your <tt class="FILENAME">/etc/shells</tt>file and the new <tt class="FILENAME">/var/tmp/root/etc/shells</tt> file. Use these todecide whether to merge in changes that you have made or whether to copy over your oldfile.</p><div class="TIP"><blockquote class="TIP"><p><b>Name the New Root Directory (<tt class="FILENAME">/var/tmp/root</tt>) with a TimeStamp, so You Can Easily Compare Differences Between Versions:</b> Frequently rebuildingthe world means that you have to update <tt class="FILENAME">/etc</tt> frequently aswell, which can be a bit of a chore.</p><p>You can speed this process up by keeping a copy of the last set of changed files thatyou merged into <tt class="FILENAME">/etc</tt>. The following procedure gives one idea ofhow to do this.</p><div class="PROCEDURE"><ol type="1"><li><p>Make the world as normal. When you want to update <tt class="FILENAME">/etc</tt> andthe other directories, give the target directory a name based on the current date. If youwere doing this on the 14th of February 1998 you could do the following:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">mkdir /var/tmp/root-19980214</kbd><samp class="PROMPT">#</samp> <kbd class="USERINPUT">cd /usr/src/etc</kbd><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">make DESTDIR=/var/tmp/root-19980214 \    distrib-dirs distribution</kbd></pre></li><li><p>Merge in the changes from this directory as outlined above.</p><p><span class="emphasis"><i class="EMPHASIS">Do not</i></span> remove the <ttclass="FILENAME">/var/tmp/root-19980214</tt> directory when you have finished.</p></li><li><p>When you have downloaded the latest version of the source and remade it, follow step1. This will give you a new directory, which might be called <ttclass="FILENAME">/var/tmp/root-19980221</tt> (if you wait a week between doingupdates).</p></li><li><p>You can now see the differences that have been made in the intervening week using <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=diff&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">diff</span>(1)</span></a> to create arecursive diff between the two directories:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">cd /var/tmp</kbd><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">diff -r root-19980214 root-19980221</kbd></pre><p>Typically, this will be a much smaller set of differences than those between <ttclass="FILENAME">/var/tmp/root-19980221/etc</tt> and <tt class="FILENAME">/etc</tt>.Because the set of differences is smaller, it is easier to migrate those changes acrossinto your <tt class="FILENAME">/etc</tt> directory.</p></li><li><p>You can now remove the older of the two <tt class="FILENAME">/var/tmp/root-*</tt>directories:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">rm -rf /var/tmp/root-19980214</kbd></pre></li><li><p>Repeat this process every time you need to merge in changes to <ttclass="FILENAME">/etc</tt>.</p></li></ol></div><p>You can use <a href="http://www.FreeBSD.org/cgi/man.cgi?query=date&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">date</span>(1)</span></a> to automatethe generation of the directory names:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">mkdir /var/tmp/root-`date "+%Y%m%d"`</kbd></pre></blockquote></div></div></div><div class="SECT2"><h2 class="SECT2"><a id="UPDATE-DEV" name="UPDATE-DEV">19.4.12 Update <ttclass="FILENAME">/dev</tt></a></h2><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> If you are running FreeBSD&nbsp;5.0 or later you can safely skip thissection. These versions use <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=devfs&sektion=5&manpath=FreeBSD+6-current"><span class="CITEREFENTRY"><span class="REFENTRYTITLE">devfs</span>(5)</span></a> toallocate device nodes transparently for the user.</p></blockquote></div><p>In most cases, the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=mergemaster&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">mergemaster</span>(8)</span></a> toolwill realize when it is necessary to update the device nodes, and offer to complete itautomatically. These instructions tell how to update the device nodes manually.</p><p>For safety's sake, this is a multi-step process.</p><div class="PROCEDURE"><ol type="1"><li><p>Copy <tt class="FILENAME">/var/tmp/root/dev/MAKEDEV</tt> to <ttclass="FILENAME">/dev</tt>:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">cp /var/tmp/root/dev/MAKEDEV /dev</kbd></pre><p>If you used <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=mergemaster&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">mergemaster</span>(8)</span></a> toupdate <tt class="FILENAME">/etc</tt>, then your <tt class="FILENAME">MAKEDEV</tt> scriptshould have been updated already, though it cannot hurt to check (with <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=diff&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">diff</span>(1)</span></a>) and copy itmanually if necessary.</p></li><li><p>Now, take a snapshot of your current <tt class="FILENAME">/dev</tt>. This snapshotneeds to contain the permissions, ownerships, major and minor numbers of each filename,but it should not contain the time stamps. The easiest way to do this is to use <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=awk&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">awk</span>(1)</span></a> to strip outsome of the information:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">cd /dev</kbd><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">ls -l | awk '{print $1, $2, $3, $4, $5, $6, $NF}' &#62; /var/tmp/dev.out</kbd></pre></li><li><p>Remake all the device nodes:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">sh MAKEDEV all</kbd></pre></li><li><p>Write another snapshot of the directory, this time to <ttclass="FILENAME">/var/tmp/dev2.out</tt>. Now look through these two files for any devicenode that you missed creating. There should not be any, but it is better to be safe thansorry.</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">diff /var/tmp/dev.out /var/tmp/dev2.out</kbd></pre><p>You are most likely to notice disk slice discrepancies which will involve commandssuch as:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">sh MAKEDEV sd0s1</kbd></pre><p>to recreate the slice entries. Your precise circumstances may vary.</p></li></ol></div></div><div class="SECT2"><h2 class="SECT2"><a id="AEN28125" name="AEN28125">19.4.13 Update <ttclass="FILENAME">/stand</tt></a></h2><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> This step is included only for completeness. It can safely be omitted. Ifyou are using FreeBSD&nbsp;5.2 or later, the <tt class="FILENAME">/rescue</tt> directoryis automatically updated for the user with current, statically compiled binaries during<tt class="COMMAND">make installworld</tt>, thus obsoleting the need to update <ttclass="FILENAME">/stand</tt>.</p></blockquote></div><p>For the sake of completeness, you may want to update the files in <ttclass="FILENAME">/stand</tt> as well. These files consist of hard links to the <ttclass="FILENAME">/stand/sysinstall</tt> binary. This binary should be statically linked,so that it can work when no other file systems (and in particular <ttclass="FILENAME">/usr</tt>) have been mounted.</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">cd /usr/src/release/sysinstall</kbd><samp class="PROMPT">#</samp> <kbd class="USERINPUT">make all install</kbd></pre></div><div class="SECT2"><h2 class="SECT2"><a id="AEN28142" name="AEN28142">19.4.14 Rebooting</a></h2><p>You are now done. After you have verified that everything appears to be in the rightplace you can reboot the system. A simple <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=shutdown&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">shutdown</span>(8)</span></a> should doit:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">shutdown -r now</kbd></pre></div><div class="SECT2"><h2 class="SECT2"><a id="AEN28151" name="AEN28151">19.4.15 Finished</a></h2><p>You should now have successfully upgraded your FreeBSD system. Congratulations.</p><p>If things went slightly wrong, it is easy to rebuild a particular piece of the system.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -