Notes: August 2003 Archives

Busybox 1.0 的 httpd

| | Comments (2)

強到沒力! 用 busybox 1.0 , 基本系統全部搞定
http 還有 cgi 功能
基本用法: httpd -h /documentroot -c /etc/httpd.conf

/*
* httpd implementation for busybox
*
* Copyright (C) 2002,2003 Glenn Engel
* Copyright (C) 2003 Vladimir Oleynik
*
* simplify patch stolen from libbb without using strdup
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*****************************************************************************
*
* Typical usage:
* for non root user
* httpd -p 8080 -h $HOME/public_html
* or for daemon start from rc script with uid=0:
* httpd -u www
* This is equivalent if www user have uid=80 to
* httpd -p 80 -u 80 -h /www -c /etc/httpd.conf -r "Web Server Authentication"
*
*
* When a url contains "cgi-bin" it is assumed to be a cgi script. The
* server changes directory to the location of the script and executes it
* after setting QUERY_STRING and other environment variables. If url args
* are included in the url or as a post, the args are placed into decoded
* environment variables. e.g. /cgi-bin/setup?foo=Hello%20World will set
* the $CGI_foo environment variable to "Hello World" while
* CONFIG_FEATURE_HTTPD_SET_CGI_VARS_TO_ENV enabled.
*
* The server can also be invoked as a url arg decoder and html text encoder
* as follows:
* foo=`httpd -d $foo` # decode "Hello%20World" as "Hello World"
* bar=`httpd -e ""` # encode as "<Hello World>"
* Note that url encoding for arguments is not the same as html encoding for
* presenation. -d decodes a url-encoded argument while -e encodes in html
* for page display.
*
* httpd.conf has the following format:
*
* A:172.20. # Allow any address that begins with 172.20
* A:10.10. # Allow any address that begins with 10.10.
* A:10.20 # Allow any address that previous set and 10.200-209.X.X
* A:127.0.0.1 # Allow local loopback connections
* D:* # Deny from other IP connections
* /cgi-bin:foo:bar # Require user foo, pwd bar on urls starting with /cgi-bin/
* /adm:admin:setup # Require user admin, pwd setup on urls starting with /adm/
* /adm:toor:PaSsWd # or user toor, pwd PaSsWd on urls starting with /adm/
* .au:audio/basic # additional mime type for audio.au files
*
* A/D may be as a/d or allow/deny - first char case unsensitive
* Deny IP rules take precedence over allow rules.
*
*
* The Deny/Allow IP logic:
*
* - Default is to allow all. No addresses are denied unless
* denied with a D: rule.
* - Order of Deny/Allow rules is significant
* - Deny rules take precedence over allow rules.
* - If a deny all rule (D:*) is used it acts as a catch-all for unmatched
* addresses.
* - Specification of Allow all (A:*) is a no-op
*
* Example:
* 1. Allow only specified addresses
* A:172.20. # Allow any address that begins with 172.20
* A:10.10. # Allow any address that begins with 10.10.
* A:10.10 # Allow any address that previous set and 10.100-109.X.X
* A:127.0.0.1 # Allow local loopback connections
* D:* # Deny from other IP connections
*
* 2. Only deny specified addresses
* D:1.2.3. # deny from 1.2.3.0 - 1.2.3.255
* D:2.3.4. # deny from 2.3.4.0 - 2.3.4.255
* A:* # (optional line added for clarity)
*
* If a sub directory contains a config file it is parsed and merged with
* any existing settings as if it was appended to the original configuration
* except that all previous IP config rules are discarded.
*
* subdir paths are relative to the containing subdir and thus cannot
* affect the parent rules.
*
* Note that since the sub dir is parsed in the forked thread servicing the
* subdir http request, any merge is discarded when the process exits. As a
* result, the subdir settings only have a lifetime of a single request.
*
*
* If -c is not set, an attempt will be made to open the default
* root configuration file. If -c is set and the file is not found, the
* server exits with an error.
*
*/

良好的備份

| | Comments (0)

想像一下, 當您的重要資料硬碟全部毀損時, 您的反應是
1. 完了, 沒備份, 畢生心血付之一炬
2. 還好有做備份, 不過是一個月前的資料
3. 還好我每天做備份, 只有損失今天的進度

3 才是良好的備份習慣

unix 下可以用 tar, cp, rsync 配合 crontab 排程做備份工作
Windows 下我推薦一套慣用的備份軟體 SecondCopy
有多樣的備份方式(支援網芳、FTP)及自動排程

備份有幾個要點
1. 要異地備份 同一台電腦需備到不同的 HD 或 MO, 同一顆 HD 不同 partition
的備份是沒有意義的, 現在硬碟不怎麼可靠
2. 使用自動排程 手動備份的話, 就是上面說的 2 狀況, 人是懶惰且健忘的
3. 只備份必要備份的資料 什麼是必要備份的資料?
因人而異, 通常是個人產生的資料, 文件, 程式碼, 而這些資料量都不會很大
相對的, 從網路上就拿得到的東西如軟體, 電影, MP3, 就是不需備份的
4. 定期將個人資料整理, 燒成光碟

目前的儲存煤體可靠度
我認為是 MO > CDR、CDRW > DVD+/-、DVD+/-RW > Compact Flash > HD

DNS 查不到?

| | Comments (0)

要兩個 lib
/lib/libnss_dns*
/lib/libresolv*
缺一不可

busybox 1.0 pre release

| | Comments (0)
busybox1.gif
busybox 1.0 與 0.65 比起來, 真是進步很多 menuconfig 介面
整合進tinylogin,udhcp
又多了一些好用的工具如 awk, rpm, unzip, tar 的 gzip 及 bzip2 支援

壓 tar czvf a.tgz files
解 tar zxvf a.tgz -C /tmp


can not poweroff ?

| | Comments (0)

BIOS 啟用 APM, kernel 有選 APM 支援, 應該就可以 poweroff,
如果不行, 試試在 boot 參數加上 apm=power-off
用 SMP 的話, 通常就要加上面那一行
若還不行, 試試 http://acpi.sourceforge.net/
patch 一下 kernel, 使用 ACPI , 應該就可以 poweroff 了
old patches download

bootsplash

| | Comments (0)

http://www.bootsplash.org

patch -p1 < /path/to/bootsplash-3.0.7-2.4.20-vanilla.diff

kernel 勾選
Console drivers --->
Frame-buffer support --->
[*] Use splash screen instead of boot logo

準備 jpeg 跟 silencejpeg
先用 rewritejpeg 處理, make sure is compatible for boot logo
或是
jpegtopnm $file | ppmtojpeg > $newfile

設定檔範例 800x600 (取自 bootsplash theme)

# Pictures provided for Mandrake by me@davidsansome.com
#
# Themed with bootSplashMaker by Stefan Reinauer
# for SuSE Linux, UnitedLinux, SLES8.
#
# current version does not implement progress bar yet.

# config file version (config 版本)
version=2

# should the picture be displayed?
state=1

# fgcolor is the text forground color. (字的前景顏色)
# bgcolor is the text background (i.e. transparent) color. (字的背景顏色)
fgcolor=0
bgcolor=15

# (tx, ty) are the (x, y) coordinates of the text window in pixels.
# tw/th is the width/height of the text window in pixels.
# tx, ty 文字區塊的 x, y 座標 (pixels)
# tw, th 文字區塊的寬跟高 (pixels)
tx=20
ty=50
tw=760
th=530

# (ax, ay) are the (x, y) coordinates for playing boot/shutdown animations
ax=112
ay=30

# name of the picture file (full path recommended)
jpeg=/tmp/Flower/images/bootsplash-800x600.jpg

設定檔範例 640x480

version=3
state=1
fgcolor=7
bgcolor=0
tx=0
ty=0
tw=640
th=480
jpeg=black.jpg
silentjpeg=bbq.jpg

輸出到 initrd
splash -s -f bootsplash.cfg >> /boot/initrd
若 initrd 為 gz 格式也行
splash -s -f bootsplash.cfg >> /boot/initrd.gz

目前 bootsplash 只支援 16bit,
640x480 使用 vga=785
800x600 使用 vga=788
1024x768 使用 vga=791

kernel boot 參數

splash=silent switches the bootsplash to silent mode initially
splash=verbose switches the bootsplash to verbose mode initially. This is default, but if you override the default in the kernel patch, you can use this option to get verbose mode back.
splash=0 switches the bootsplash off

make device ppp

| | Comments (0)

mknod /dev/ppp c 108 0

make device loop

| | Comments (0)

for i in 0 1 2 3 4 5 6 7; do mknod /dev/loop$i b 7 $i; done

xcin 更新預設輸入法

| | Comments (0)

edit /etc/chinese/xcin/xcinrc

(define zh_TW
'((DEFAULT_IM "cj")

(define zh_TW.Big5
'((DEFAULT_IM "cj")

Pages

March 2008

Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          

About this Archive

This page is a archive of entries in the Notes category from August 2003.

Notes: July 2003 is the previous archive.

Notes: September 2003 is the next archive.

Find recent content on the main index or look in the archives to find all content.