<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>【牧碼志】</title>
	<atom:link href="http://sinolog.it/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://sinolog.it</link>
	<description>晴耕雨讀 ...</description>
	<lastBuildDate>Sun, 05 Sep 2010 01:13:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>WordPress Plugin: Batch Cat</title>
		<link>http://sinolog.it/?p=1603</link>
		<comments>http://sinolog.it/?p=1603#comments</comments>
		<pubDate>Sat, 04 Sep 2010 10:11:14 +0000</pubDate>
		<dc:creator>lenin</dc:creator>
				<category><![CDATA[编程]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://sinolog.it/?p=1603</guid>
		<description><![CDATA[Introduction Batch Cat is intended to help users change categories of posts in bulk. The main features are: Intuitionistic operating manners which come up with people&#8217;s common practice. Configurable number of posts listed in one page. Slimming but enough searching and sorting options. More in the future. Screenshot Installation &#038; Usage As usual, upload the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://picasaweb.google.com/lh/photo/bqYPszwt0P7OI9snKxv3WA?feat=embedwebsite"><img src="http://sinolog.it/tool/imagoxy/getimg.php?u=%3D%3DwZuBnL0F2Ytg2Y0FmYtA3dvADM4M3Lvp3bKhVe0REafF3LrRmQBFUQBFUQBF0LJRWOw0SRu1USJR1LjpHSUJEbfpUVlN2Xv02bj5CdoB3Zn5yMox2LvoDc0RHa" /></a></p>
<h3>Introduction</h3>
<p>Batch Cat is intended to help users change categories of posts in bulk.</p>
<p>The main features are:</p>
<ol>
<li>Intuitionistic operating manners which come up with people&#8217;s common practice.</li>
<li>Configurable number of posts listed in one page.</li>
<li>Slimming but enough searching and sorting options.</li>
<li>More in the future.</li>
</ol>
<h3>Screenshot</h3>
<p><a href="http://picasaweb.google.com/lh/photo/HbcUjNJ5wuK_XtIUxw1GWw?feat=embedwebsite"><img src="http://sinolog.it/tool/imagoxy/getimg.php?u=n5GcuQXYj9FajRXYi1ibpdWdsB3XzNXZyBHZy92dvADM0M3Lr9GW6NVRyJXa4EzLjRmQBFUQBFUQBF0LJRkd5IVLxsUSJR1LjpHSUJEbfpUVlN2Xv02bj5CdoB3Zn5yMox2LvoDc0RHa" /></a></p>
<h3>Installation &#038; Usage</h3>
<p>As usual, upload the folder of Batch Cat to the wordpress plugin directory, activate it then.</p>
<p>You can perform operations in the page which lies in <b>Tools->Batch Cat</b> in the admin panel.</p>
<p>To alter settings of this plugin, go to <b>Settings->Batch Cat Settings</b>.</p>
<h3>Download</h3>
<p>Batch Cat is now hosted in the wordpress plugin repository:</p>
<p>http://wordpress.org/extend/plugins/batch-cat/</p>
<h3>Wish List</h3>
<ol>
<li>I18N</li>
<li>More search options</li>
<li>More information in the post list</li>
</ol>
<h3>Change Log</h3>
<blockquote><p>
<b>2010-09-04 Saturday</b><br />
Initial release.
</p></blockquote>
<h3  class="related_post_title">您也许会对这些感兴趣</h3><ul class="related_post"><li><a href="http://sinolog.it/?p=1597" title="讀完《WordPress Plug-in Development》">讀完《WordPress Plug-in Development》</a></li><li><a href="http://sinolog.it/?p=1293" title="Wordpress Plugin: Anti Manpower Spam">Wordpress Plugin: Anti Manpower Spam</a></li><li><a href="http://sinolog.it/?p=1175" title="imagoxy:sswv的救赎">imagoxy:sswv的救赎</a></li><li><a href="http://sinolog.it/?p=759" title="Wordpress插件：Jay Access Flickr Mod">Wordpress插件：Jay Access Flickr Mod</a></li><li><a href="http://sinolog.it/?p=755" title="启用bcSpamBlock+Simple Trackback Validation">启用bcSpamBlock+Simple Trackback Validation</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://sinolog.it/?feed=rss2&amp;p=1603</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>讀完《WordPress Plug-in Development》</title>
		<link>http://sinolog.it/?p=1597</link>
		<comments>http://sinolog.it/?p=1597#comments</comments>
		<pubDate>Sun, 29 Aug 2010 03:07:24 +0000</pubDate>
		<dc:creator>lenin</dc:creator>
				<category><![CDATA[青梅煮酒]]></category>
		<category><![CDATA[讀書]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[日志]]></category>

		<guid isPermaLink="false">http://sinolog.it/?p=1597</guid>
		<description><![CDATA[花了兩天時間讀完了《WordPress Plug-in Development》，通過實例講解，很細致，適合用來入門，當然，深度和廣度都有限。 您也许会对这些感兴趣WordPress Plugin: Batch Cat升级到wordpress3.0Wordpress Plugin: Anti Manpower Spamimagoxy:sswv的救赎Wordpress插件：Jay Access Flickr Mod]]></description>
			<content:encoded><![CDATA[<p>花了兩天時間讀完了《WordPress Plug-in Development》，通過實例講解，很細致，適合用來入門，當然，深度和廣度都有限。</p>
<p><a href="http://picasaweb.google.com/lh/photo/k7nT3M9jrDW1dPv-nzKJvQ?feat=embedwebsite"><img src="http://sinolog.it/tool/imagoxy/getimg.php?u=%3DcGcq5CduVWbw9GblZXZk1ibpdWdsBXLzNXZyBHZy92dvADM0M3L0gFcxhlcwVXbC90LJRmQBFUQBFUQBF0LJxGRapEV34kbIR1LjpHSUJEbfpUVlN2Xv02bj5CdoB3Zn5CNox2LvoDc0RHa" /></a></p>
<h3  class="related_post_title">您也许会对这些感兴趣</h3><ul class="related_post"><li><a href="http://sinolog.it/?p=1603" title="WordPress Plugin: Batch Cat">WordPress Plugin: Batch Cat</a></li><li><a href="http://sinolog.it/?p=1512" title="升级到wordpress3.0">升级到wordpress3.0</a></li><li><a href="http://sinolog.it/?p=1293" title="Wordpress Plugin: Anti Manpower Spam">Wordpress Plugin: Anti Manpower Spam</a></li><li><a href="http://sinolog.it/?p=1175" title="imagoxy:sswv的救赎">imagoxy:sswv的救赎</a></li><li><a href="http://sinolog.it/?p=759" title="Wordpress插件：Jay Access Flickr Mod">Wordpress插件：Jay Access Flickr Mod</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://sinolog.it/?feed=rss2&amp;p=1597</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>批量下載視頻的BASH腳本</title>
		<link>http://sinolog.it/?p=1589</link>
		<comments>http://sinolog.it/?p=1589#comments</comments>
		<pubDate>Sat, 28 Aug 2010 14:57:14 +0000</pubDate>
		<dc:creator>lenin</dc:creator>
				<category><![CDATA[编程]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[腳本]]></category>
		<category><![CDATA[視頻]]></category>
		<category><![CDATA[下载]]></category>

		<guid isPermaLink="false">http://sinolog.it/?p=1589</guid>
		<description><![CDATA[兩周前為了批量下載某視頻網站中的電視劇，寫了個BASH腳本。將電視劇列表頁面的URL地址作為唯一參數傳給腳本，然後就會把所有視頻下載到當前目錄下，并自動重命名，同時生成一個M3U格式的播放列表。 由于在線視頻不支持斷點續傳，所以對于單個視頻來說無法實現。但對于整個批量下載任務來說，實現了宏觀上的斷點續傳，已經下載的視頻不會被重復下載。由于有些視頻網站會在午夜更改視頻地址，所以這一點很有用。 主流視頻網站應該是都支持的，我只測試了我下載電視劇的網站，不支持的都是非主流的！ 唯一可能需要注意的依賴是PHP，必須安裝後才能使用。 PLAIN TEXT BASH: #!/bin/bash &#160; print_help_msg &#40;&#41; &#123; &#160; &#160; echo &#34;You see, I'm nothing .&#34; &#160; &#160; exit 0 &#125; &#160; check_param &#40;&#41; &#123; &#160; &#160; if &#91; $# -ne 1 &#93;; then &#160; &#160; &#160; &#160; print_help_msg &#160; &#160; fi &#125; &#160; check_m3u &#40;&#41; &#123; &#160; &#160; if ! [...]]]></description>
			<content:encoded><![CDATA[<p>兩周前為了批量下載某視頻網站中的電視劇，寫了個BASH腳本。將電視劇列表頁面的URL地址作為唯一參數傳給腳本，然後就會把所有視頻下載到當前目錄下，并自動重命名，同時生成一個M3U格式的播放列表。</p>
<p>由于在線視頻不支持斷點續傳，所以對于單個視頻來說無法實現。但對于整個批量下載任務來說，實現了宏觀上的斷點續傳，已經下載的視頻不會被重復下載。由于有些視頻網站會在午夜更改視頻地址，所以這一點很有用。</p>
<p>主流視頻網站應該是都支持的，我只測試了我下載電視劇的網站，<strong>不支持的都是非主流的！</strong></p>
<p>唯一可能需要注意的依賴是PHP，必須安裝後才能使用。</p>
<div class="igBar"><span id="lbash-2"><a href="#" onclick="javascript:showPlainTxt('bash-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-2">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">print_help_msg <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;You see, I'm nothing .&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">check_param <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;color:#800000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; print_help_msg</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">check_m3u <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-a</span> p.m3u <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">wc</span> <span style="color: #660033;">-l</span> p.m3u<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $1 }'</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;color:#800000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'#EXTM3U'</span><span style="color: #000000; font-weight: bold;">&gt;</span> p.m3u</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">check_param <span style="color: #007800;">$*</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">check_m3u</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">LC_ALL</span>=en_US.UTF-<span style="color: #000000;color:#800000;">8</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">ue</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>php <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;echo urlencode('$1');&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">parser</span>=<span style="color: #ff0000;">&quot;http://www.flvcd.com/parse.php?flag=&amp;format=&amp;kw=<span style="color: #007800;">$ue</span>&amp;sbt=%BF%AA%CA%BCGO%21&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #007800;">$parser</span> <span style="color: #660033;">-U</span> mozilla <span style="color: #660033;">-O</span> meta.html ; <span style="color: #000000; font-weight: bold;">then</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Unable to touch the parser, check network status for the cause .&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">fi</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;&lt;N&gt;&quot;</span> meta.html<span style="color: #000000; font-weight: bold;">&gt;</span> title.lst</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;&lt;U&gt;&quot;</span> meta.html<span style="color: #000000; font-weight: bold;">&gt;</span> url.lst</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">iconv <span style="color: #660033;">-f</span> gbk <span style="color: #660033;">-t</span> utf-<span style="color: #000000;color:#800000;">8</span> title.lst <span style="color: #660033;">-o</span> title.lst</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">'s/&lt;N&gt;//g'</span> title.lst</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">'s/ //g'</span> title.lst</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">'s/&lt;U&gt;//g'</span> url.lst</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">l1</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">wc</span> <span style="color: #660033;">-l</span> title.lst<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $1 }'</span><span style="color: #000000; font-weight: bold;">`</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">l2</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">wc</span> <span style="color: #660033;">-l</span> url.lst<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $1 }'</span><span style="color: #000000; font-weight: bold;">`</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$l1</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;<span style="color: #007800;">$l2</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Title.lst has <span style="color: #007800;">$l1</span> lines, but url.lst got <span style="color: #007800;">$l2</span>.&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">fi</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$l1</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;color:#800000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Nothing got from the parser, check meta.html for detail info.&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">fi</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">arrTitle</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> title.lst<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">arrURL</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> url.lst<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #007800;">idx</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">wc</span> <span style="color: #660033;">-l</span> p.m3u<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $1 }'</span><span style="color: #000000; font-weight: bold;">`</span>-<span style="color: #000000;color:#800000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$idx</span> <span style="color: #660033;">-lt</span> <span style="color: #007800;">$l1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">do</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #007800;">title</span>=<span style="color: #800000;">${arrTitle[$idx]}</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #007800;">url</span>=<span style="color: #800000;">${arrURL[$idx]}</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #007800;">idx</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>idx+<span style="color: #000000;color:#800000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #007800;">$url</span> <span style="color: #660033;">-U</span> mozilla <span style="color: #660033;">-O</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${title}</span>.flv&quot;</span> ; <span style="color: #000000; font-weight: bold;">then</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Failed fetching <span style="color: #007800;">${title}</span>.flv, maybe its URL has been changed !&quot;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;color:#800000;">0</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #007800;">cmd</span>=<span style="color: #ff0000;">&quot;sed -i '<span style="color: #000099; font-weight: bold;">\$</span>a\<span style="color: #000099; font-weight: bold;">\$</span>{title}.flv' p.m3u&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #007800;">$cmd</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">done</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'done !'</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;color:#800000;">0</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>另外，使用VLC執行播放列表效果灰常不錯，視頻之間銜接平滑流暢。</p>
<h3  class="related_post_title">您也许会对这些感兴趣</h3><ul class="related_post"><li><a href="http://sinolog.it/?p=1534" title="Linux下pppoe连接建立后仍不能上网的问题">Linux下pppoe连接建立后仍不能上网的问题</a></li><li><a href="http://sinolog.it/?p=1522" title="cd到目录下后自动ls的方法">cd到目录下后自动ls的方法</a></li><li><a href="http://sinolog.it/?p=1200" title="不同弹窗方式致动态下载成败">不同弹窗方式致动态下载成败</a></li><li><a href="http://sinolog.it/?p=1124" title="笔记拆分脚本notesplitter.py">笔记拆分脚本notesplitter.py</a></li><li><a href="http://sinolog.it/?page_id=199" title="Sandbox">Sandbox</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://sinolog.it/?feed=rss2&amp;p=1589</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>启动GVim时自动最大化窗口的方法</title>
		<link>http://sinolog.it/?p=1575</link>
		<comments>http://sinolog.it/?p=1575#comments</comments>
		<pubDate>Wed, 25 Aug 2010 02:20:15 +0000</pubDate>
		<dc:creator>lenin</dc:creator>
				<category><![CDATA[计算机]]></category>
		<category><![CDATA[窗口管理器]]></category>
		<category><![CDATA[配置]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://sinolog.it/?p=1575</guid>
		<description><![CDATA[根据帮助文档，gvim在windows下的最大化是通过模拟打开窗口菜单并点击最大化菜单项实现的，而在Linux下的方法较为灵活。 下面的方法是在vim中通过调用wmctrl实现最大化的方法： PLAIN TEXT VIM: if has&#40;'win32'&#41; &#160; &#160; au GUIEnter * simalt ~x else &#160; &#160; au GUIEnter * call MaximizeWindow&#40;&#41; endif &#160; function! MaximizeWindow&#40;&#41; &#160; &#160; silent !wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz endfunction 当然也可以通过配置窗口管理器规则实现自动最大化，但上面的方法更灵活。 您也许会对这些感兴趣使Windows上的GVim可以使用任意中文字体Windows下gvim的全屏Vim的终极自动补全插件：NeoComplCacheVim的多文件查询使用vimcolorschemetest预览vim的颜色主题]]></description>
			<content:encoded><![CDATA[<p>根据帮助文档，gvim在windows下的最大化是通过模拟打开窗口菜单并点击最大化菜单项实现的，而在Linux下的方法较为灵活。</p>
<p>下面的方法是在vim中通过调用wmctrl实现最大化的方法：</p>
<div class="igBar"><span id="lvim-4"><a href="#" onclick="javascript:showPlainTxt('vim-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VIM:</span>
<div id="vim-4">
<div class="vim" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #804040;">if</span> <span style="color: #25BB4D;">has</span><span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">'win32'</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; au GUIEnter <span style="color: #000000;">*</span> simalt <span style="color: #000000;">~</span>x</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #804040;">else</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; au GUIEnter <span style="color: #000000;">*</span> <span style="color: #804040;">call</span> MaximizeWindow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #804040;">endif</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #804040;">function</span><span style="color: #000000;">!</span> MaximizeWindow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; silent <span style="color: #000000;">!</span>wmctrl <span style="color: #000000;">-</span>r <span style="color: #000000;">:</span>ACTIVE<span style="color: #000000;">:</span> <span style="color: #000000;">-</span>b <span style="color: #25BB4D;">add</span>,maximized_vert,maximized_horz</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">endfunction</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>当然也可以通过配置窗口管理器规则实现自动最大化，但上面的方法更灵活。</p>
<h3  class="related_post_title">您也许会对这些感兴趣</h3><ul class="related_post"><li><a href="http://sinolog.it/?p=1262" title="使Windows上的GVim可以使用任意中文字体">使Windows上的GVim可以使用任意中文字体</a></li><li><a href="http://sinolog.it/?p=1212" title="Windows下gvim的全屏">Windows下gvim的全屏</a></li><li><a href="http://sinolog.it/?p=1399" title="Vim的终极自动补全插件：NeoComplCache">Vim的终极自动补全插件：NeoComplCache</a></li><li><a href="http://sinolog.it/?p=1307" title="Vim的多文件查询">Vim的多文件查询</a></li><li><a href="http://sinolog.it/?p=1265" title="使用vimcolorschemetest预览vim的颜色主题">使用vimcolorschemetest预览vim的颜色主题</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://sinolog.it/?feed=rss2&amp;p=1575</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>InstallShield在MySQL和Oracle中执行SQL脚本的方法</title>
		<link>http://sinolog.it/?p=1567</link>
		<comments>http://sinolog.it/?p=1567#comments</comments>
		<pubDate>Tue, 24 Aug 2010 15:28:52 +0000</pubDate>
		<dc:creator>lenin</dc:creator>
				<category><![CDATA[编程]]></category>
		<category><![CDATA[InstallShield]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[安装]]></category>
		<category><![CDATA[客户端]]></category>
		<category><![CDATA[数据库]]></category>

		<guid isPermaLink="false">http://sinolog.it/?p=1567</guid>
		<description><![CDATA[简述 InstallShield已经内建了对MySQL和Oracle的支持。但是这个功能是通过ODBC实现的，它对SQL脚本的格式要求非常严格，因此已经通过官方客户端测试的脚本在IS中执行时往往就会报错。 一般来说，数据库脚本只保证通过官方客户端测试即可，同时维护一份供IS执行的脚本费时费力。因此，考虑安装程序对两数据库的支持通过官方客户端实现。 MySQL PLAIN TEXT INNO: function InstallMySQLComponent&#40;szComponent&#41; &#160; &#160; NUMBER nResult; &#160; &#160; STRING szServer,szDB,szUser,szPassword,sCMD,sOPT,sResult1,sResult2,svLine,sMsg,sPath; &#160; &#160; NUMBER nvFileHandle,nvCount; &#160; &#160; LIST listStatus; begin &#160; &#160; sMsg = '安装'+szComponent+' ...'; &#160; &#160; SdShowMsg&#40;sMsg, TRUE&#41;; &#160; &#160; // source命令不认识windows路径中的反斜杠，故将SRCDIR中的反斜杠替换成斜杠 &#160; &#160; sPath = SRCDIR; &#160; &#160; StrReplace&#40;sPath, '\\', '/', 0&#41;; &#160; &#160; // Fetch [...]]]></description>
			<content:encoded><![CDATA[<h2>简述</h2>
<p>InstallShield已经内建了对MySQL和Oracle的支持。但是这个功能是通过ODBC实现的，它对SQL脚本的格式要求非常严格，因此已经通过官方客户端测试的脚本在IS中执行时往往就会报错。</p>
<p>一般来说，数据库脚本只保证通过官方客户端测试即可，同时维护一份供IS执行的脚本费时费力。因此，考虑安装程序对两数据库的支持通过官方客户端实现。</p>
<h2>MySQL</h2>
<p></p>
<div class="igBar"><span id="linno-7"><a href="#" onclick="javascript:showPlainTxt('inno-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">INNO:</span>
<div id="inno-7">
<div class="inno" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;font-style: italic;">function</span> InstallMySQLComponent<span style="color: #66cc66;">&#40;</span>szComponent<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; NUMBER nResult;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #CC0000;">STRING</span> szServer,szDB,szUser,szPassword,sCMD,sOPT,sResult1,sResult2,svLine,sMsg,sPath;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; NUMBER nvFileHandle,nvCount;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; LIST listStatus;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;font-style: italic;">begin</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; sMsg = <span style="color: #ff0000;">'安装'</span>+szComponent+<span style="color: #ff0000;">' ...'</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; SdShowMsg<span style="color: #66cc66;">&#40;</span>sMsg, <span style="color: #000000;font-style: italic;">TRUE</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #33FF00; font-style: italic;">// source命令不认识windows路径中的反斜杠，故将SRCDIR中的反斜杠替换成斜杠</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; sPath = SRCDIR;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; StrReplace<span style="color: #66cc66;">&#40;</span>sPath, <span style="color: #ff0000;">'\\'</span>, <span style="color: #ff0000;">'/'</span>, <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #33FF00; font-style: italic;">// Fetch database connection information</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; SQLRTGetConnectionInfo<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'mysql'</span>, szServer, szDB, szUser, szPassword <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; sCMD = WINSYSDIR^<span style="color: #ff0000;">'cmd.exe'</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; sOPT = <span style="color: #ff0000;">' /c '</span>+SRCDIR^<span style="color: #ff0000;">'mysql.exe -h'</span>+szServer+<span style="color: #ff0000;">' -u'</span>+szUser+<span style="color: #ff0000;">' -p'</span>+szPassword+<span style="color: #ff0000;">' -D'</span>+szDB;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; sOPT = sOPT+<span style="color: #ff0000;">' -e &quot;source '</span>+sPath^szComponent+<span style="color: #ff0000;">'.sql&quot;&gt; '</span>+SRCDIR^<span style="color: #ff0000;">'dbstatus.txt 2&gt;&amp;1'</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #33FF00; font-style: italic;">// Execute the script associated with the given component in database</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; nResult=LaunchAppAndWait<span style="color: #66cc66;">&#40;</span>sCMD, sOPT, WAIT<span style="color: &nbsp;#000000; font-weight: bold;">|</span>LAAW_OPTION_HIDDEN<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000;font-style: italic;">if</span> <span style="color: #66cc66;">&#40;</span>nResult <span style="color: &nbsp;#000000; font-weight: bold;">&lt;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000;font-style: italic;">then</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; MessageBox<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Failed installing '</span>+szComponent+<span style="color: #ff0000;">' !'</span>, SEVERE<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; abort;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; endif;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #33FF00; font-style: italic;">// 关闭安装提示</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; SdShowMsg<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">''</span>, <span style="color: #000000;font-style: italic;">FALSE</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #33FF00; font-style: italic;">// Read dbstatus.txt</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; OpenFileMode<span style="color: #66cc66;">&#40;</span>FILE_MODE_NORMAL<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000;font-style: italic;">if</span> <span style="color: #66cc66;">&#40;</span>OpenFile<span style="color: #66cc66;">&#40;</span>nvFileHandle, SRCDIR, <span style="color: #ff0000;">'dbstatus.txt'</span><span style="color: #66cc66;">&#41;</span><span style="color: &nbsp;#000000; font-weight: bold;">&lt;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000;font-style: italic;">then</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; MessageBox<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Failed checking the status of installing '</span>+szComponent+<span style="color: #ff0000;">' !'</span>, SEVERE<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; abort;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; endif;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; listStatus = ListCreate<span style="color: #66cc66;">&#40;</span>STRINGLIST<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000;font-style: italic;">while</span> GetLine<span style="color: #66cc66;">&#40;</span>nvFileHandle, svLine<span style="color: #66cc66;">&#41;</span> = <span style="color: #cc66cc;color:#800000;">0</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; ListAddString<span style="color: #66cc66;">&#40;</span>listStatus, svLine, AFTER<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; endwhile;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #0000FF;">CloseFile</span><span style="color: #66cc66;">&#40;</span>nvFileHandle<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #33FF00; font-style: italic;">// Count how many lines fetched from dbstatus.txt</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; nvCount = ListCount<span style="color: #66cc66;">&#40;</span>listStatus<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000;font-style: italic;">if</span> nvCount<span style="color: &nbsp;#000000; font-weight: bold;">&gt;</span> <span style="color: #cc66cc;color:#800000;">0</span> <span style="color: #000000;font-style: italic;">then</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; sMsg = <span style="color: #ff0000;">&quot;更新数据库出错，点“是”打开日志文件并退出安装，点“否”直接退出安装。\n&quot;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; sMsg = sMsg+<span style="color: #ff0000;">&quot;若错误可忽略，可选择数据库类型“none”以跳过数据库更新并直接更新程序，\n&quot;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; sMsg = sMsg+<span style="color: #ff0000;">&quot;然后在数据库中手工执行SQL脚本（安装后保存在script目录下）&quot;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; nResult = AskYesNo<span style="color: #66cc66;">&#40;</span>sMsg, YES<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;font-style: italic;">if</span> <span style="color: #66cc66;">&#40;</span>nResult = YES<span style="color: #66cc66;">&#41;</span> <span style="color: #000000;font-style: italic;">then</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LaunchApp<span style="color: #66cc66;">&#40;</span>WINSYSDIR^<span style="color: #ff0000;">'notepad.exe'</span>, SRCDIR^<span style="color: #ff0000;">'dbstatus.txt'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; endif; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; abort;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; endif;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;font-style: italic;">end</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h2>Oracle</h2>
<p></p>
<div class="igBar"><span id="linno-8"><a href="#" onclick="javascript:showPlainTxt('inno-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">INNO:</span>
<div id="inno-8">
<div class="inno" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;font-style: italic;">function</span> InstallOracleComponent<span style="color: #66cc66;">&#40;</span>szComponent<span style="color: #66cc66;">&#41;</span> &nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; NUMBER nResult,nvFileHandle,nIndex,nvCount;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #CC0000;">STRING</span> sMsg,szServer,szDB,szUser,szPassword,sCMD,sOPT,sInstance,sTmp,svLine;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; LIST listStatus;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;font-style: italic;">begin</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; sMsg = <span style="color: #ff0000;">'安装'</span>+szComponent+<span style="color: #ff0000;">' ...'</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; SdShowMsg<span style="color: #66cc66;">&#40;</span>sMsg, <span style="color: #000000;font-style: italic;">TRUE</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #33FF00; font-style: italic;">// Fetch database connection information</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; SQLRTGetConnectionInfo<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'oracle'</span>, szServer, szDB, szUser, szPassword <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; nIndex = StrFind<span style="color: #66cc66;">&#40;</span>szServer, <span style="color: #ff0000;">':'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; nIndex = StrFindEx<span style="color: #66cc66;">&#40;</span>szServer, <span style="color: #ff0000;">'/'</span>, nIndex<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; StrSub<span style="color: #66cc66;">&#40;</span>sInstance, szServer, nIndex+<span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; sCMD = WINSYSDIR^<span style="color: #ff0000;">'cmd.exe'</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; sOPT = <span style="color: #ff0000;">' /c '</span>+<span style="color: #ff0000;">'sqlplus.exe -L -S '</span>+szUser+<span style="color: #ff0000;">'/'</span>+szPassword+<span style="color: #ff0000;">'@'</span>+sInstance;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; sOPT = sOPT+<span style="color: #ff0000;">' @'</span>+SRCDIR^szComponent+<span style="color: #ff0000;">'.sql&gt; '</span>+SRCDIR^<span style="color: #ff0000;">'dbstatus.txt 2&gt;&amp;1'</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #33FF00; font-style: italic;">// Execute the script associated with the given component in database</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; nResult=LaunchAppAndWait<span style="color: #66cc66;">&#40;</span>sCMD, sOPT, WAIT<span style="color: &nbsp;#000000; font-weight: bold;">|</span>LAAW_OPTION_HIDDEN<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000;font-style: italic;">if</span> <span style="color: #66cc66;">&#40;</span>nResult <span style="color: &nbsp;#000000; font-weight: bold;">&lt;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000;font-style: italic;">then</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; MessageBox<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Failed installing '</span>+szComponent+<span style="color: #ff0000;">' !'</span>, SEVERE<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; abort;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; endif; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #33FF00; font-style: italic;">// 关闭安装提示</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; SdShowMsg<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">''</span>, <span style="color: #000000;font-style: italic;">FALSE</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #33FF00; font-style: italic;">// 在dbstatus.txt中查询字符串holytail，如果存在，说明脚本已执行完</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000;font-style: italic;">if</span> <span style="color: #66cc66;">&#40;</span>FileGrep<span style="color: #66cc66;">&#40;</span>SRCDIR^<span style="color: #ff0000;">'dbstatus.txt'</span>, <span style="color: #ff0000;">'holytail'</span>, svLine, nIndex, <span style="color: #000000;font-style: italic;">RESTART</span><span style="color: #66cc66;">&#41;</span> = <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000;font-style: italic;">then</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #33FF00; font-style: italic;">// 在dbstatus.txt中查询字符串ORA-，如果存在，说明脚本执行出现错误</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;font-style: italic;">if</span> <span style="color: #66cc66;">&#40;</span>FileGrep<span style="color: #66cc66;">&#40;</span>SRCDIR^<span style="color: #ff0000;">'dbstatus.txt'</span>, <span style="color: #ff0000;">'ORA-'</span>, svLine, nIndex, <span style="color: #000000;font-style: italic;">RESTART</span><span style="color: #66cc66;">&#41;</span> = <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000;font-style: italic;">then</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sMsg = <span style="color: #ff0000;">&quot;更新数据库出错，点“是”打开日志文件并退出安装，点“否”直接退出安装。\n&quot;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sMsg = sMsg+<span style="color: #ff0000;">&quot;若错误可忽略，可选择数据库类型“none”以跳过数据库更新并直接更新程序，\n&quot;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sMsg = sMsg+<span style="color: #ff0000;">&quot;然后在数据库中手工执行SQL脚本（安装后保存在script目录下）&quot;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nResult = AskYesNo<span style="color: #66cc66;">&#40;</span>sMsg, YES<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;font-style: italic;">if</span> <span style="color: #66cc66;">&#40;</span>nResult = YES<span style="color: #66cc66;">&#41;</span> <span style="color: #000000;font-style: italic;">then</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LaunchApp<span style="color: #66cc66;">&#40;</span>WINSYSDIR^<span style="color: #ff0000;">'notepad.exe'</span>, SRCDIR^<span style="color: #ff0000;">'dbstatus.txt'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; endif; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; abort;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; endif;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000;font-style: italic;">else</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; sMsg = <span style="color: #ff0000;">&quot;更新数据库出错，点“是”打开日志文件并退出安装，点“否”直接退出安装。\n&quot;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; sMsg = sMsg+<span style="color: #ff0000;">&quot;若错误可忽略，可选择数据库类型“none”以跳过数据库更新并直接更新程序，\n&quot;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; sMsg = sMsg+<span style="color: #ff0000;">&quot;然后在数据库中手工执行SQL脚本（安装后保存在script目录下）&quot;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; nResult = AskYesNo<span style="color: #66cc66;">&#40;</span>sMsg, YES<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;font-style: italic;">if</span> <span style="color: #66cc66;">&#40;</span>nResult = YES<span style="color: #66cc66;">&#41;</span> <span style="color: #000000;font-style: italic;">then</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LaunchApp<span style="color: #66cc66;">&#40;</span>WINSYSDIR^<span style="color: #ff0000;">'notepad.exe'</span>, SRCDIR^<span style="color: #ff0000;">'dbstatus.txt'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; endif; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; abort;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; endif;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;font-style: italic;">end</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h2>总结</h2>
<ol>
<li>为便于获取脚本在数据库中的执行结果，故通过官方客户端执行脚本时通过符号“<strong>></strong>”将客户端的输出信息重定向到<strong>dbstatus.txt</strong>中；同时，使用“<strong>2>&#038;1</strong>”将标准错误输出重定向到标准输出设备上，当然，会进一步重定向到dbstatus.txt文件中，否则，无法获取出错信息。</li>
<li>sqlplus执行SQL脚本后不会自动退出，故应在Oracle的脚本后加上语句“<strong>exit;</strong>”。</li>
<li>重载<strong>OnSQLComponentInstalled()</strong>函数，并在其中禁止MySQL和Oracle的SQL脚本对应的Component被执行安装，然后通过以上两个函数更新数据库。</li>
</ol>
<h3  class="related_post_title">您也许会对这些感兴趣</h3><ul class="related_post"><li><a href="http://sinolog.it/?p=1494" title="Inno Setup执行SQL脚本的方法">Inno Setup执行SQL脚本的方法</a></li><li><a href="http://sinolog.it/?p=1525" title="Linux下使用freetds连接SQL Server">Linux下使用freetds连接SQL Server</a></li><li><a href="http://sinolog.it/?p=1350" title="使用PL/SQL Developer连接Oracle服务器">使用PL/SQL Developer连接Oracle服务器</a></li><li><a href="http://sinolog.it/?p=1423" title="SQL Server的自定义函数：统计两日期之间工作日的数量">SQL Server的自定义函数：统计两日期之间工作日的数量</a></li><li><a href="http://sinolog.it/?p=1385" title="SQLAlchemy操作SQL Server的中文问题">SQLAlchemy操作SQL Server的中文问题</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://sinolog.it/?feed=rss2&amp;p=1567</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使Thinkpad的静音按钮能被识别的方法</title>
		<link>http://sinolog.it/?p=1561</link>
		<comments>http://sinolog.it/?p=1561#comments</comments>
		<pubDate>Mon, 09 Aug 2010 14:56:35 +0000</pubDate>
		<dc:creator>lenin</dc:creator>
				<category><![CDATA[计算机]]></category>
		<category><![CDATA[GNOME]]></category>
		<category><![CDATA[ThinkPad]]></category>
		<category><![CDATA[XFCE]]></category>
		<category><![CDATA[内核]]></category>
		<category><![CDATA[桌面环境]]></category>

		<guid isPermaLink="false">http://sinolog.it/?p=1561</guid>
		<description><![CDATA[我的型号是X200，问题表现为在GNOME或XFCE下静音按钮无效，使用xev也捕获不到输入信号，而音量增加和减小按钮可以正常使用且有OSD。 解决办法是在grub的启动菜单中，给内核加上参数acpi_osi=“Linux”，如： PLAIN TEXT BASH: # (0) Arch Linux title &#160;Arch Linux root &#160; &#40;hd0,2&#41; kernel /boot/vmlinuz26 root=/dev/sda3 resume=/dev/sda4 ro acpi_osi=&#34;Linux&#34; initrd /boot/kernel26.img 从查到的资料看，acpi_osi参数是用来指定操作系统接口的，据说有些硬件都只针对Windows做了测试或优化，对于这些硬件，如果将内核的操作系统接口指定为Linux，则有可能会出问题。所以内核从2.6.23版本开始，此参数的默认值被改成了“!Linux”，以保证更广泛的兼容性和稳定性。 而根据这里的说法，thinkpad一直以来在对Linux的兼容程度上有很好的口碑，故可以放心添加这个参数。 另外，xfce下使用OSD需要安装xfce4-volumed。 您也许会对这些感兴趣被迫弃UMS而用KMS非Gnome/Xfce环境下的GTK主题管理Gnome中关闭光驱自动播放功能及修改默认自动播放程序在Gnome下编译KDE环境的程序swfdec：简单好用的Flash播放器]]></description>
			<content:encoded><![CDATA[<p>我的型号是X200，问题表现为在GNOME或XFCE下静音按钮无效，使用xev也捕获不到输入信号，而音量增加和减小按钮可以正常使用且有OSD。</p>
<p>解决办法是在grub的启动菜单中，给内核加上参数<strong>acpi_osi=“Linux”</strong>，如： </p>
<div class="igBar"><span id="lbash-10"><a href="#" onclick="javascript:showPlainTxt('bash-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-10">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;"># (0) Arch Linux</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">title &nbsp;Arch Linux</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">root &nbsp; <span style="color: #7a0874; font-weight: bold;">&#40;</span>hd0,<span style="color: #000000;color:#800000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">kernel <span style="color: #000000; font-weight: bold;">/</span>boot<span style="color: #000000; font-weight: bold;">/</span>vmlinuz26 <span style="color: #007800;">root</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda3 <span style="color: #007800;">resume</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda4 ro <span style="color: #007800;">acpi_osi</span>=<span style="color: #ff0000;">&quot;Linux&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">initrd <span style="color: #000000; font-weight: bold;">/</span>boot<span style="color: #000000; font-weight: bold;">/</span>kernel26.img</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>从查到的资料看，<strong>acpi_osi</strong>参数是用来指定操作系统接口的，据说有些硬件都只针对Windows做了测试或优化，对于这些硬件，如果将内核的操作系统接口指定为Linux，则有可能会出问题。所以内核从2.6.23版本开始，此参数的默认值被改成了“<strong>!Linux</strong>”，以保证更广泛的兼容性和稳定性。</p>
<p>而根据<a href="http://www.thinkwiki.org/wiki/Mute_button">这里</a>的说法，thinkpad一直以来在对Linux的兼容程度上有很好的口碑，故可以放心添加这个参数。 </p>
<p>另外，xfce下使用OSD需要安装xfce4-volumed。</p>
<h3  class="related_post_title">您也许会对这些感兴趣</h3><ul class="related_post"><li><a href="http://sinolog.it/?p=1377" title="被迫弃UMS而用KMS">被迫弃UMS而用KMS</a></li><li><a href="http://sinolog.it/?p=173" title="非Gnome/Xfce环境下的GTK主题管理">非Gnome/Xfce环境下的GTK主题管理</a></li><li><a href="http://sinolog.it/?p=76" title="Gnome中关闭光驱自动播放功能及修改默认自动播放程序">Gnome中关闭光驱自动播放功能及修改默认自动播放程序</a></li><li><a href="http://sinolog.it/?p=69" title="在Gnome下编译KDE环境的程序">在Gnome下编译KDE环境的程序</a></li><li><a href="http://sinolog.it/?p=1556" title="swfdec：简单好用的Flash播放器">swfdec：简单好用的Flash播放器</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://sinolog.it/?feed=rss2&amp;p=1561</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>swfdec：简单好用的Flash播放器</title>
		<link>http://sinolog.it/?p=1556</link>
		<comments>http://sinolog.it/?p=1556#comments</comments>
		<pubDate>Sun, 01 Aug 2010 15:25:33 +0000</pubDate>
		<dc:creator>lenin</dc:creator>
				<category><![CDATA[计算机]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[GNOME]]></category>
		<category><![CDATA[多媒体]]></category>

		<guid isPermaLink="false">http://sinolog.it/?p=1556</guid>
		<description><![CDATA[早在keke童鞋的博客上见过，直到今天下载了个flash视频教程要看时才想起来，毕竟已经不是几年前Flash很火的时候了，为了降低CPU占用，我连Chromium的Flash插件都禁用了。 使用后的感觉就是简单实用，有暂停，有快进，能调进度，功能一样不多，一样不少。 要装两个包，swfdec是解码包，swfdec-gnome是播放器。 http://swfdec.freedesktop.org 您也许会对这些感兴趣Linux下的Flash播放器汇总使Thinkpad的静音按钮能被识别的方法Buuf-Deuce：搞怪的图标主题Archlinux升级到GNOME2.30后的光标主题问题立方体归来]]></description>
			<content:encoded><![CDATA[<p>早在keke童鞋的<a href="http://www.imkeke.net/linux/flash-player-swfdec.html">博客</a>上见过，直到今天下载了个flash视频教程要看时才想起来，毕竟已经不是几年前Flash很火的时候了，为了降低CPU占用，我连Chromium的Flash插件都禁用了。</p>
<p>使用后的感觉就是简单实用，有暂停，有快进，能调进度，功能一样不多，一样不少。</p>
<p>要装两个包，swfdec是解码包，swfdec-gnome是播放器。</p>
<p><a href="http://swfdec.freedesktop.org">http://swfdec.freedesktop.org</a></p>
<p><a href="http://picasaweb.google.com/lh/photo/pBEyuoK_FQwurdii1Oekdg?feat=embedwebsite"><img src="http://sinolog.it/tool/imagoxy/getimg.php?u=%3D%3DwZuBnLxAjLBJUJDhTJ1UUJ5gTJwgTJ5UUJ2kTJGhTJ1UUJBFUJ4gTJ2UUJuIzMBNTJ3ETQzUyMy4SMw0COw0CMxAjMvADM0M3L0QEWwZDWrdzZGl0LjNmQBFUQBFUQBF0LJ5WU6d3U1E1VGR1LjpHSUJEbfpUVlN2Xv02bj5CdoB3Zn5iNox2LvoDc0RHa" /></a></p>
<h3  class="related_post_title">您也许会对这些感兴趣</h3><ul class="related_post"><li><a href="http://sinolog.it/?p=282" title="Linux下的Flash播放器汇总">Linux下的Flash播放器汇总</a></li><li><a href="http://sinolog.it/?p=1561" title="使Thinkpad的静音按钮能被识别的方法">使Thinkpad的静音按钮能被识别的方法</a></li><li><a href="http://sinolog.it/?p=1440" title="Buuf-Deuce：搞怪的图标主题">Buuf-Deuce：搞怪的图标主题</a></li><li><a href="http://sinolog.it/?p=1438" title="Archlinux升级到GNOME2.30后的光标主题问题">Archlinux升级到GNOME2.30后的光标主题问题</a></li><li><a href="http://sinolog.it/?p=1279" title="立方体归来">立方体归来</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://sinolog.it/?feed=rss2&amp;p=1556</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>TTL线在Linux下的用法</title>
		<link>http://sinolog.it/?p=1551</link>
		<comments>http://sinolog.it/?p=1551#comments</comments>
		<pubDate>Sun, 18 Jul 2010 14:50:07 +0000</pubDate>
		<dc:creator>lenin</dc:creator>
				<category><![CDATA[计算机]]></category>
		<category><![CDATA[破解]]></category>
		<category><![CDATA[驱动]]></category>
		<category><![CDATA[内核]]></category>

		<guid isPermaLink="false">http://sinolog.it/?p=1551</guid>
		<description><![CDATA[虽然由于我的H108B没有TTL引脚而无法通过TTL线登入猫的BusyBox系统，但TTL线在Linux下的使用方法仍然值得一叙，因为除此之外，它还有较为广泛的用途，例如为路由器刷OpenWRT系统等等。 TTL转USB端子是目前较为常见的此类设备，这得益于它的简单易用和便携性。在这类设备上最常见的就是台湾的Prolific Technology生产的PL2303： 这种芯片的驱动已被编译进Linux内核，如果使用的是较新版本的内核，则使用该芯片的TTL转USB端子会被自动识别，通常为/dev/ttyUSB0设备，使用lsusb命令可以查看： [lenin@archer ~]$ lsusb Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub 将四根杜邦线连接到TTL转USB插头上，并接入相应设备的对应引脚。同一根线两端连接的引脚必须对应，另外，VCC引脚不能接线，否则会烧坏TTL转 USB芯片。 在计算机上使用串口通讯程序进行操控，常见的串口通讯程序有：minicom，microcom，picocom，tinyserial，xgcom。 [...]]]></description>
			<content:encoded><![CDATA[<p>虽然由于<a href="http://sinolog.it/?p=1544">我的H108B</a>没有TTL引脚而无法通过TTL线登入猫的<a href="http://en.wikipedia.org/wiki/BusyBox">BusyBox</a>系统，但TTL线在Linux下的使用方法仍然值得一叙，因为除此之外，它还有较为广泛的用途，例如为路由器刷<a href="http://en.wikipedia.org/wiki/OpenWrt">OpenWRT</a>系统等等。</p>
<p>TTL转USB端子是目前较为常见的此类设备，这得益于它的简单易用和便携性。在这类设备上最常见的就是台湾的Prolific Technology生产的<strong>PL2303</strong>：</p>
<p><a href="http://picasaweb.google.com/lh/photo/fAc0kt6VmnFFTUY7IA-VrA?feat=embedwebsite"><img src="http://sinolog.it/tool/imagoxy/getimg.php?u=nBnaucTMtcDMtETMwITJ3ETL3ATLwEDMy8FM2MzQvADM0M3LB1ibUBlWFF2NBZ0LVJmQBFUQBFUQBF0LJR1NuZTdxIGSFR1LjpHSUJEbfpUVlN2Xv02bj5CdoB3Zn5yMox2LvoDc0RHa" /></a></p>
<p>这种芯片的驱动已被编译进Linux内核，如果使用的是较新版本的内核，则使用该芯片的TTL转USB端子会被自动识别，通常为<strong>/dev/ttyUSB0</strong>设备，使用<strong>lsusb</strong>命令可以查看：</p>
<blockquote><p>
[lenin@archer ~]$ lsusb<br />
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 006 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port<br />
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
</p></blockquote>
<p>将四根杜邦线连接到TTL转USB插头上，并接入相应设备的对应引脚。同一根线两端连接的引脚必须对应，另外，VCC引脚不能接线，否则会烧坏TTL转 USB芯片。</p>
<p>在计算机上使用串口通讯程序进行操控，常见的串口通讯程序有：<a href="http://en.wikipedia.org/wiki/Minicom">minicom</a>，<a href="http://en.wikipedia.org/wiki/Microcom">microcom</a>，picocom，tinyserial，xgcom。</p>
<p>以minicom为例，进入minicom的设置界面：</p>
<blockquote><p>sudo minicom -s</p></blockquote>
<p>先设置默认的通讯设备为ttyUSB0并设置硬件流控制（Hardware Flow Control）为No：</p>
<p><a href="http://picasaweb.google.com/lh/photo/YnqotA0Fo6Z883T7aKvDcg?feat=embedwebsite"><img src="http://sinolog.it/tool/imagoxy/getimg.php?u=%3D%3DwZuBnLxAjLBJUJDhTJ1UUJ5gTJwgTJ5UUJ2kTJGhTJ1UUJBFUJ4gTJ2UUJugzMBNTJ1ITQzUCMx4yNx0yNw0CMxAjMvADM4M3LNVXaFp1NFNTTv52L0ImQBFUQBFUQBF0LJhlNPBTM3IVTFR1LjpHSUJEbfpUVlN2Xv02bj5CdoB3Zn5SNox2LvoDc0RHa" /></a></p>
<p><a href="http://picasaweb.google.com/lh/photo/G2S6THC9IqvBChZGkJfyqQ?feat=embedwebsite"><img src="http://sinolog.it/tool/imagoxy/getimg.php?u=n5GcuEDMuQnd4JXduQDMBNTJ5ITQzUCMx4yNx0yNw0CMxAjMvADM0M3Lj5mcqZ2Uv91M2o1L4ImQBFUQBFUQBF0LJ12YqJke3IVTFR1LjpHSUJEbfpUVlN2Xv02bj5CdoB3Zn5iNox2LvoDc0RHa" /></a></p>
<p>保存为缺省设置：</p>
<p><a href="http://picasaweb.google.com/lh/photo/lY9b49woVJhLdkPJqViT3Q?feat=embedwebsite"><img src="http://sinolog.it/tool/imagoxy/getimg.php?u=%3D%3DwZuBnLxAjLBJUJDhTJ1UUJ5gTJwgTJ5UUJ2kTJGhTJ1UUJBFUJ4gTJ2UUJuUzMBNTJ5ITQzUCMx4yNx0yNw0CMxAjMvADM4M3LZ9UMqpXRjNHSuF1LBNmQBFUQBFUQBF0LJN2MrpmR4IVTFR1LjpHSUJEbfpUVlN2Xv02bj5CdoB3Zn5CNox2LvoDc0RHa" /></a></p>
<p>启动minicom：</p>
<blockquote><p>sudo minicom</p></blockquote>
<p>理论上说，此时即可和设备进行通讯了。</p>
<p>Windows下要安装相应芯片的驱动，通讯程序一般用SecureCRT。</p>
<h3  class="related_post_title">您也许会对这些感兴趣</h3><ul class="related_post"><li><a href="http://sinolog.it/?p=1561" title="使Thinkpad的静音按钮能被识别的方法">使Thinkpad的静音按钮能被识别的方法</a></li><li><a href="http://sinolog.it/?p=1544" title="网通ADSL猫开启路由和自动拨号功能的方法之二">网通ADSL猫开启路由和自动拨号功能的方法之二</a></li><li><a href="http://sinolog.it/?p=1528" title="网通ADSL猫开启路由和自动拨号功能的方法之一">网通ADSL猫开启路由和自动拨号功能的方法之一</a></li><li><a href="http://sinolog.it/?p=1377" title="被迫弃UMS而用KMS">被迫弃UMS而用KMS</a></li><li><a href="http://sinolog.it/?p=970" title="Archlinux下驱动Intel GMA X4500显卡">Archlinux下驱动Intel GMA X4500显卡</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://sinolog.it/?feed=rss2&amp;p=1551</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>网通ADSL猫开启路由和自动拨号功能的方法之二</title>
		<link>http://sinolog.it/?p=1544</link>
		<comments>http://sinolog.it/?p=1544#comments</comments>
		<pubDate>Sat, 17 Jul 2010 17:03:05 +0000</pubDate>
		<dc:creator>lenin</dc:creator>
				<category><![CDATA[计算机]]></category>
		<category><![CDATA[ADSL]]></category>
		<category><![CDATA[破解]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[wifi]]></category>
		<category><![CDATA[密码]]></category>
		<category><![CDATA[日志]]></category>

		<guid isPermaLink="false">http://sinolog.it/?p=1544</guid>
		<description><![CDATA[之前提到过对华为HG522、HG527的超级用户的破解方法。网通附送的另一种猫，是中兴ZXV10 H108B无线猫，体积更小，而且天线是内置的。 上次的方法不能用在这个型号的猫上，但可以用ftp的方式破解。以下步骤基于Linux，并只在硬件版本为V1.1.02、软件版本为V1.1.02T18_N的H108B上测试通过： 1. 使用普通用户进入猫的设置页面并开启FTP服务，将用户名和密码均设为admin 2. 连接ftp服务器： ftp 192.168.1.1 输入用户名和密码，成功登录FTP服务器： [lenin@archer ~]$ ftp 192.168.1.1 Connected to 192.168.1.1. 220 Welcome to virtual FTP service. Name (192.168.1.1:lenin): admin 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> 3. 切换到/etc目录并下载配置文件board.conf： cd ../ cd etc get board.conf [...]]]></description>
			<content:encoded><![CDATA[<p>之前提到过对华为HG522、HG527的超级用户的<a href="http://sinolog.it/?p=1528">破解方法</a>。网通附送的另一种猫，是<strong>中兴ZXV10 H108B</strong>无线猫，体积更小，而且天线是内置的。</p>
<p>上次的方法不能用在这个型号的猫上，但可以用<strong>ftp</strong>的方式破解。以下步骤基于Linux，并只在硬件版本为<strong>V1.1.02</strong>、软件版本为<strong>V1.1.02T18_N</strong>的H108B上测试通过：</p>
<p>1. 使用<strong>普通用户</strong>进入猫的设置页面并开启FTP服务，将用户名和密码均设为<strong>admin</strong></p>
<p>2. 连接ftp服务器：</p>
<blockquote><p>
ftp 192.168.1.1
</p></blockquote>
<p>输入用户名和密码，成功登录FTP服务器：</p>
<blockquote><p>
[lenin@archer ~]$ ftp 192.168.1.1<br />
Connected to 192.168.1.1.<br />
220 Welcome to virtual FTP service.<br />
Name (192.168.1.1:lenin): admin<br />
331 Please specify the password.<br />
Password:<br />
230 Login successful.<br />
Remote system type is UNIX.<br />
Using binary mode to transfer files.<br />
ftp>
</p></blockquote>
<p>3. 切换到<strong>/etc</strong>目录并下载配置文件<strong>board.conf</strong>：</p>
<blockquote><p>
cd ../<br />
cd etc<br />
get board.conf
</p></blockquote>
<p>如下所示：</p>
<blockquote><p>
ftp> cd ../<br />
250 Directory successfully changed.<br />
ftp> cd etc<br />
250 Directory successfully changed.<br />
ftp> get board.conf<br />
200 PORT command successful. Consider using PASV.<br />
150 Opening BINARY mode data connection for board.conf (39516 bytes).<br />
226 File send OK.<br />
39516 bytes received in 0.0496 seconds (796003 bytes/s)<br />
ftp>
</p></blockquote>
<p>4. 在下载到本地的board.conf中查找<strong>right</strong>，后跟<strong>0</strong>表示超级用户，若为<strong>1</strong>则表示普通用户，如下所示：</p>
<div class="igBar"><span id="lxml-12"><a href="#" onclick="javascript:showPlainTxt('xml-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-12">
<div class="xml" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;row</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>&quot;right&quot;, &quot;0&quot;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>&quot;username&quot;, &quot;bjcnchgw&quot;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>&quot;enable&quot;, &quot;1&quot;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>&quot;password&quot;, &quot;bjcnchgw72915767&quot;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/row<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;row</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>&quot;right&quot;, &quot;1&quot;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>&quot;username&quot;, &quot;user&quot;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>&quot;password&quot;, &quot;mypasswd&quot;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/row<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>5. 在如下页面使用超级用户登录：</p>
<blockquote>
<p>http://192.168.1.1/cnc.html</p>
</blockquote>
<p>6. 进入“<strong>网络</strong>”→“<strong>宽带设置</strong>”页面，删除所有“<strong>连接名称</strong>”列出的连接（<em>其中，TR069是网通远程控制猫并修改超级用户密码的连接；INTERNET被设置成了桥接，所以不能实现路由功能；另外两个应该是用来屏蔽第三、四个LAN口的。所以要全部删除。</em>），并创建新的连接：</p>
<p><a href="http://picasaweb.google.com/lh/photo/G5p8or5AvVumvFOr89XLqQ?feat=embedwebsite"><img src="http://sinolog.it/tool/imagoxy/getimg.php?u=%3D%3DwZuBnLxAjLBJUJDhTJ1UUJ5gTJwgTJ5UUJ2kTJGhTJ1UUJBFUJ4gTJ2UUJuAzMBNTJ4QTQzUSOx4yNx0yNw0CMxAjMvADM0M3LNpUeHtEdw4Ge0d2LzJmQBFUQBFUQBF0LJZETFh1dwQGSFR1LjpHSUJEbfpUVlN2Xv02bj5CdoB3Zn5SNox2LvoDc0RHa" /></a></p>
<p>7. 进入“<strong>网络</strong>”→“<strong>远程管理</strong>”页面，取消“<strong>周期上报功能</strong>”。</p>
<p>8. 由于“<strong>用户管理</strong>”页面不提供超级用户改密码的功能，所以此时应下载最新的board.conf，修改里面的超级用户的密码，再上传到/etc目录，假设已登入FTP并切换到/etc目录下：</p>
<blockquote><p>
ftp> put board.conf<br />
200 PORT command successful. Consider using PASV.<br />
150 Ok to send data.<br />
226 File receive OK.<br />
39516 bytes sent in 0.0195 seconds (2026565 bytes/s)<br />
ftp>
</p></blockquote>
<p>9. 最后重启猫即可。</p>
<p>据说有使用TTL转USB线登入H108B的嵌入式Linux操作系统来破解超级用户的，但是我的猫的集成电路板上居然没有焊TTL引脚，显然H108B不只一个硬件版本，TTL线白买了。</p>
<p><a href="http://picasaweb.google.com/lh/photo/ceYq8gDnT3qY6IgBQuyjFg?feat=embedwebsite"><img src="http://sinolog.it/tool/imagoxy/getimg.php?u=nBnauATMtcDMtETMwITJ3ETL3ATLwEDMy8FM2MzQvADM0M3LvdVTCN2ZQFHbLt0LZJmQBFUQBFUQBF0LJxWR0FXexIGSFR1LjpHSUJEbfpUVlN2Xv02bj5CdoB3Zn5iNox2LvoDc0RHa" /></a></p>
<p><a href="http://picasaweb.google.com/lh/photo/omFbqTXkvVV4L86vGqyyng?feat=embedwebsite"><img src="http://sinolog.it/tool/imagoxy/getimg.php?u=nBnauEjMtYDMtETMwITJ3ETL3ATLwEDMy8FM2MzQvADM0M3LNVldVF0VoNVY6dzLjJmQBFUQBFUQBF0LJp3QHxWOxIGSFR1LjpHSUJEbfpUVlN2Xv02bj5CdoB3Zn5yMox2LvoDc0RHa" /></a></p>
<p><a href="http://picasaweb.google.com/lh/photo/JfG_3EgD8BDChZVBM6xx9Q?feat=embedwebsite"><img src="http://sinolog.it/tool/imagoxy/getimg.php?u=nBnaukDMtYDMtETMwITJ3ETL3ATLwEDMy8FM2MzQvADM0M3LrhEWmN3dIhkehh0LnJmQBFUQBFUQBF0LJh2drhFSyIGSFR1LjpHSUJEbfpUVlN2Xv02bj5CdoB3Zn5iNox2LvoDc0RHa" /></a></p>
<p><em>以上照片出自G7+Camera360</em></p>
<h3  class="related_post_title">您也许会对这些感兴趣</h3><ul class="related_post"><li><a href="http://sinolog.it/?p=1528" title="网通ADSL猫开启路由和自动拨号功能的方法之一">网通ADSL猫开启路由和自动拨号功能的方法之一</a></li><li><a href="http://sinolog.it/?p=1597" title="讀完《WordPress Plug-in Development》">讀完《WordPress Plug-in Development》</a></li><li><a href="http://sinolog.it/?p=1551" title="TTL线在Linux下的用法">TTL线在Linux下的用法</a></li><li><a href="http://sinolog.it/?p=1534" title="Linux下pppoe连接建立后仍不能上网的问题">Linux下pppoe连接建立后仍不能上网的问题</a></li><li><a href="http://sinolog.it/?p=1512" title="升级到wordpress3.0">升级到wordpress3.0</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://sinolog.it/?feed=rss2&amp;p=1544</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux下pppoe连接建立后仍不能上网的问题</title>
		<link>http://sinolog.it/?p=1534</link>
		<comments>http://sinolog.it/?p=1534#comments</comments>
		<pubDate>Sat, 10 Jul 2010 03:02:29 +0000</pubDate>
		<dc:creator>lenin</dc:creator>
				<category><![CDATA[计算机]]></category>
		<category><![CDATA[ADSL]]></category>
		<category><![CDATA[Archlinux]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[配置]]></category>

		<guid isPermaLink="false">http://sinolog.it/?p=1534</guid>
		<description><![CDATA[问题描述 pppoe可以连接，ifconfig可以看到ppp0接口，一切正常，只是不能上网。 解决办法 使用如下命令查看路由表： PLAIN TEXT BASH: route 正常情况下返回的结果中应该有如下内容： default * 0.0.0.0 U 0 0 0 ppp0 如果没有，可手工添加： PLAIN TEXT BASH: route add default dev ppp0 如果可以上网，就成功了。 使用如下脚本在pppoe连接成功时自动添加路由表项： PLAIN TEXT BASH: #!/bin/sh &#160; if ifconfig ppp0 &#62; /dev/null 2&#62;&#38;1 ; then &#160; &#160; route del default &#160; &#160; route add default dev ppp0 fi 将上述内容保存成名为01-route.sh的文件，权限755，放到/etc/ppp/ip-up.d目录下。 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>问题描述</strong></p>
<p>pppoe可以连接，ifconfig可以看到ppp0接口，一切正常，只是不能上网。</p>
<p><strong>解决办法</strong></p>
<p>使用如下命令查看路由表：</p>
<div class="igBar"><span id="lbash-18"><a href="#" onclick="javascript:showPlainTxt('bash-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-18">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">route</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>正常情况下返回的结果中应该有如下内容：</p>
<blockquote><p>
default  *  0.0.0.0   U   0   0  0 ppp0
</p></blockquote>
<p>如果没有，可手工添加：</p>
<div class="igBar"><span id="lbash-19"><a href="#" onclick="javascript:showPlainTxt('bash-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-19">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">route add default dev ppp0</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>如果可以上网，就成功了。</p>
<p>使用如下脚本在pppoe连接成功时自动添加路由表项：</p>
<div class="igBar"><span id="lbash-20"><a href="#" onclick="javascript:showPlainTxt('bash-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-20">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #c20cb9; font-weight: bold;">ifconfig</span> ppp0 <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000;color:#800000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;color:#800000;">1</span> ; <span style="color: #000000; font-weight: bold;">then</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; route del default</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; route add default dev ppp0</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">fi</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>将上述内容保存成名为<strong>01-route.sh</strong>的文件，权限<strong>755</strong>，放到<strong>/etc/ppp/ip-up.d</strong>目录下。</p>
<p>然后创建以下两个脚本：</p>
<div class="igBar"><span id="lbash-21"><a href="#" onclick="javascript:showPlainTxt('bash-21'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-21">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #c20cb9; font-weight: bold;">ifconfig</span> ppp0 <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000;color:#800000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;color:#800000;">1</span> ; <span style="color: #000000; font-weight: bold;">then</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'PPPOE has already been switched on !'</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">fi</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">off</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> pon</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;color:#800000;">5</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ppp<span style="color: #000000; font-weight: bold;">/</span>ip-up</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lbash-22"><a href="#" onclick="javascript:showPlainTxt('bash-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-22">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #c20cb9; font-weight: bold;">ifconfig</span> ppp0 <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000;color:#800000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;color:#800000;">1</span> ; <span style="color: #000000; font-weight: bold;">then</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'PPPOE has already been switched off !'</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">fi</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> poff</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ppp<span style="color: #000000; font-weight: bold;">/</span>ip-down</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>分别命名为<strong>on</strong>和<strong>off</strong>并复制到环境变量PATH下，以后即可使用这两个脚本建立和注销pppoe连接。</p>
<p><strong>原因分析</strong></p>
<p>问题的原因是pppoe连接建立时，没有自动往路由表中添加相关路由项。</p>
<p>一般情况下，如果使用的是<strong>ppp</strong>做pppoe连接，其配置文件中默认会开启<strong>defaultroute</strong>选项，该选项的作用就是在pppoe连接建立时自动添加路由表项，但在路由表中已经存在<strong>default</strong>项时，该操作将不会进行。</p>
<p>一般有两种情况会使路由表中在pppoe连接建立前就存在default项。一种情况是网络接口配置中设置了route，如在archlinux下，就是rc.conf文件中的gateway项。如果使用的是静态地址，则需要做这种配置，但对于大多数使用DHCP动态分配IP地址的情况，这项配置则不需要。另一种情况就是ADSL Modem自带路由功能，在分配IP给计算机时也会自动添加一条路由表项。</p>
<h3  class="related_post_title">您也许会对这些感兴趣</h3><ul class="related_post"><li><a href="http://sinolog.it/?p=1377" title="被迫弃UMS而用KMS">被迫弃UMS而用KMS</a></li><li><a href="http://sinolog.it/?p=1304" title="真理不死：Tor with bridges + Polipo">真理不死：Tor with bridges + Polipo</a></li><li><a href="http://sinolog.it/?p=1221" title="使用wicd管理网络">使用wicd管理网络</a></li><li><a href="http://sinolog.it/?p=1161" title="Archlinux下设定GDM音效">Archlinux下设定GDM音效</a></li><li><a href="http://sinolog.it/?p=1155" title="Archlinux变更modprobe配置文件路径">Archlinux变更modprobe配置文件路径</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://sinolog.it/?feed=rss2&amp;p=1534</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
