这是第二次发布,与前一次相比,架构已经完全不同了,请大家试用,有任何问题,请告诉我,谢谢
附件是源码,如有需要,可以到这里下载、查看其他相关信息
[url=http://sourceforge.net/projects/netkite]http://sourceforge.net/projects/netkite
我把man贴出来便于大家快速检索
BTW, 感谢mq100, flw教我制作man的方法, 这个就是flw的pod2man方法生成的man,相当好用:)
NAME
netkite - custom upgrade system
SYNOPSIS
netkite [HOST] [OPTIONS]
DESCRIPTION
Netkite is a network upgrade system that integrates the server and the
client. It can be used in system patching. Support all the file types of
linux.
Each directory under the root of the server is called a module, the
files included in which can be gotten by the client; the module is
inheritable.
The client specifies a module name when connecting to the server, and
checks with md5 sum whether the files in the received module require
upgrade.
With the rule file corresponded to the upgrade file, the server controls
the client’s behavior of upgrade, which include four actions such as
creating and deleting. Rule file, which suffix is .rule, is in the same
directory and with the same name as upgrade file. Refer to relevant
description for the rules of config file and detailed examples. eg: the
directory structure is as follows:
root/
l- module_a/
l- father/
l- file1
l- file1.rule
l- son
l- file2
l- file2.rule
If the client specifies module father, the server will deliver file1 to
the client and trace back to root, then the communication ends; if the
client specifies module son, the server will first deliver file2 to the
client. son is inherited from father, then the server will deliver file1
to the client. Create necessary paths if it inexistent after getting
files.
The default parameter of the client operates only for once, or the
operation can be circulated by changing the parameter. During the
circulation, signal SIGALRM can help compel the client to start a new
connection.
If the command line parameter is the same as the config file’s, then it
has high PRI.
OPTIONS
The command line parameters shall be in one-to-one correspondence with
the ones of config file; refer to CONFIG FILE for the default value of
options.
-p *port* specify communication port
-t *second* set the timeout in seconds
-x *logfile* specify the absolute path of log file
-f *conf* sepcify config file
-r *root* specify the absolute path of root directory for server
-b *backlog* set listening backlog for server
-d *second* indicate executive cycle for client
-m *module* specify a name of accepted module for client
-X *tmp* specify the absolute path of tmp directory for client
-s switch to server mode
-c switch to client mode, default
-v print current version
-h print this help page
-H print config file help page
-g turn off log record
-G turn on log record, default
-o display available configuration
RULE FILE
NAMING
With the suffix .rule, it is in the same directory and with the same
name as upgrade file.
FORMAT
Each line of rule file is either a comment or a directive. A Comment
line starts with a # and is ignored. A directive line has the format:
key = value
The valid key and its value are:
name = /root/file The position and name of the direction upgrade file
stored in the client.
= /root/dir/ Since directory is explained as the module name, if an
empty directory will be provided for the client, then add a slash behind
the file.
act = create The act of direction file upgrade, if it is not specified,
default it as create. Get the different files from the server no matter
whether a file or directly exists in the name specified position or not.
= remove Remove the file or directly existing in the name specified
position; if the directory exists, it shall be empty.
= update Update the file or directory if existing; if the directory
exists in the name specified position, it shall be empty.
= unique Update from the server only if no file or directory exists in
the name specified position.
dev = /dev/hdb1 Which device dose the direction file exist in; if it is
not specified, default it as in system current directory structure, it
is the most commonly used measuree.
CONFIG FILE
The default config file is /etc/netkite.conf, the format is like RULE
FILE. Type "netkite -H" to print following contents; and original config
file can be generated though the redirection to file.
# specify remote the server address in the client mode
address = 127.0.0.1
# specify listening network interface in the server mode
interface = 0.0.0.0
# switch to the server or the client mode
the server_mode = no
# turn on/off log record
log_enable = yes
# specify communication port
port = 7002
# set the timeout in seconds
timeout = 75
# specify the absolute path of log file
log_file = /var/log/netkite.log
# specify the absolute path of root directory for the server
root = /var/netkite
# set listening backlog for the server
backlog = 1024
# indicate executive cycle for the client,
# if 0, then run one time only
idle = 0
# specify a name of accepted module for the client
module = test
# specify the absolute path of tmp directory for the client
tmp_path = /tmp
EXAMPLES
In the server mode
At first, netkite will chroot to root, then create this directory in
case it does not already exist.
1. Create the server root directory /var/netkite:
sh-2.05b# mkdir /var/netkite
2. Create test module father and son:
sh-2.05b# mkdir /var/netkite/father
sh-2.05b# mkdir /var/netkite/father/son
3. Put test file to father and son
sh-2.05b# echo "hello" > /var/netkite/father/regular
sh-2.05b# echo "hello" > /var/netkite/father/dir
sh-2.05b# ln -s /root /var/netkite/father/son/link
4. Create rule file for upgrade file as follows:
sh-2.05b# cat /var/netkite/father/regular.rule
name = /misc/test1
act = create
sh-2.05b# cat /var/netkite/father/dir.rule
name = /misc/test2/
sh-2.05b# cat /var/netkite/father/son/link.rule
name = /misc/test3
dev = /dev/hdb1
5. Execute netkite in server mode:
sh-2.05b# netkite -s
In the client mode
a. Specify the accepted module name as father and the ip address
10.0.0.1 of the server, and execute netkite:
sh-2.05b# netkite 10.0.0.1 -m father
The client gets file regular and empty directory dir from the
server, which be stored in /misc/; then regular is named as test1
and dir test2. If no /misc/ exists, the client will create it.
b. Specify the accepted module name as son:
sh-2.05b# netkite 10.0.0.1 -m son
The client gets symbol link link and stores it in /misc/ under
partition /dev/hdb1, naming it as test3. Due to the inheritable
relation between the modules, the two files in father will also be
got later.
LOG FORMAT
The server
return_code state_info client_addr [module name] transmit_file_name
The client
return_code state_info action_info device_name->receive_file_name
Note: 1. Action_info includes three states:
upgrade:
The content of file is modified.
change:
The attribute of file is changed.
remove:
The file is removed.
2. If dev is not specified in rule file, device_name will not appear in log file.
FILES
/etc/netkite.conf Default config file.
/var/netkite Default root directory of the server.
/var/log/netkite.log Default Log file.
/tmp Default temp file directory of the client.
BUGS
1. If no dependence relation between upgrade files exists, the demand
for this shall be realized by the feature that child module takes
precedence of father module.
2. Considering the security, the removal of non-empty directory is not
supported now.
3. The server does not log the files removed by the client.
Bug report to <binary@eniak.org>.
[ 本帖最后由 isnowran 于 2006-11-17 14:46 编辑 ]
moyuhappy 回复于:2006-10-05 01:32:16
rsync相比,这个还差一点
langue 回复于:2006-10-05 08:23:12
嘿嘿,鼓励人家一下也好嘛,写代码、写程序,不是那么容易的
醉卧水云间 回复于:2006-10-05 09:45:16
鼓励,我也有个项目在SF。
isnowran 回复于:2006-10-05 16:53:43
引用:原帖由 moyuhappy 于 2006-10-5 01:32 发表
rsync相比,这个还差一点
谢谢各位的鼓励与支持,非常感谢!
说明一下,它与rsync是无法相比的,不是一个数量级的程序:)
但是,与rsync的策略有所不同,如图所示:
rsync:
server client
|- dirA |- dirA
|- file_1 |- file_1
|- file_2 |- file_2
|- file_3 |- file_3
netkite:
server client
|- dirA |- dirC
|- file_1 | |- file_1
|- file_2 |
|- file_3 |- dirD
| |- file_2
|
|- /dev/hdb1/dirE
|- file_3
rsync的主要的用途是同步,也就是把服务端的目录结构原样搬移到客户端某个目录下;
netkite的主要用途是修补,也就是说,把某个目录作为一个发布源,客户端指定一个源目录(模块),来修补客户端的整个根目录结构每一个需要修补的文件,并且不局限于当前目录结构,也可以是客户端当前未挂载的有效设备
告化甲头 回复于:2006-10-06 16:04:02
试试
isnowran 回复于:2006-10-08 23:56:23
另外,对其他发行版不熟悉,我只在redhat和ubuntu下测试过,如果有哪位朋友有其他的系统,请帮我测试一下安装以及运行,谢谢!
isnowran 回复于:2006-11-17 14:43:34
netkite-0.8.1-pre1 发布,欢迎大家试用,期待大家的意见及建议,谢谢。
ChangeLog
0.8.1.305
==============
* check whether the file name start with '/', if not, add it.
* fix the abnormal return when client without the device specify by server
- close the screen error informations and redirect them to log.
- fix parse library function trim prototype with static.
0.8.0.299
==============
- initialize a struct statfs in netkite.cpp.
- fix some nameing rules.
0.8.0.298
==============
first times released.
isnowran 回复于:2006-12-15 03:22:55
netkite-0.8.2-pre1 发布,主要改动
1. 修正了一个由于交验大文件引起超时后的应答错误
2. 客户端日志增加完成标记
3. 其他一些细微改动
netkite-0.8.2-pre1.tar.gz
longshort 回复于:2006-12-15 08:09:59
非常好,非常正规!
zw2002 回复于:2006-12-15 10:07:02
支持,能说明一下是怎么生成的man吗?
isnowran 回复于:2006-12-15 14:00:42
引用:原帖由 zw2002 于 2006-12-15 10:07 发表
支持,能说明一下是怎么生成的man吗?
我是用pod2man生成的
zx_wing 回复于:2006-12-15 15:57:19
支持一个,希望SF有越来越多我们中国人的项目!
isnowran 回复于:2007-01-01 13:07:38
昨晚更新到0.9.0.315,主要更新如下
0.9.0.315
==============
* insert a respond at serial send/recv protocol version and module name.
that mean not compatible previous version.
* after the temp file receiving completed, the client blocks all signals
when replacing the destination file.
- initialize the m_sock when construct the tcpbase object.
- fix the man page some error.
MD5: 4f2a9275084aa4dfc55486ec9949243c
[ 本帖最后由 isnowran 于 2007-1-1 13:09 编辑 ]
netkite-0.9.0-pre1.tar.gz
bleem1998 回复于:2007-01-01 13:18:02
干什么用的啊
isnowran 回复于:2007-01-25 17:23:51
昨晚更新到0.9.0.315,主要更新如下,增加了一个覆盖模式,如果覆盖模式关闭(默认),那么客户端在更新时会忽略多于1个的相同目标文件,这样就能客户端获取的是服务端提供的最深层的更新文件,这也正是你所想的:)
0.9.1.325
==============
* add overlap mode, now have correct inherit relation.
- change the function name and argument in the mdc library.
- change -h and -H infomation( about overlap mode ).
- change man page( about overlap mode ).
MD5: 41908783f69563a9c94326cad3bf8f4c
netkite-0.9.1-pre1.tar.gz
isnowran 回复于:2007-06-18 13:22:32
这是来自CUDev的短消息,非常感谢CUDev的支持,在此做一些解答.
问:
引用:
我只是看了manual,感觉netkite有些不是很完善的地方:
1、只能够在服务器端设置,客户端更新;最好能够支持客户端上传模式,客户端能够将一些文件更新到服务器上,供其他机器使用、或者是自己想恢复以前的文件
2、如果有一个module叫a,下面有一个子目录c;
还有一个模块叫b,下面也有一个子目录叫c;
客户端执行netkite 10.0.0.1 -m c时候怎么处理?
root/
l- a/
l- c
l- file1
l- file1.rule
l- b/
l- c
l- file2
l- file2.rule
我感觉你这种自底向上更新的方式不是很好?
BTW:Code没有编译过去,好像使用了kernel-header里面的一些头文件
答:
引用:
1. 因为netkite的初衷是为修补无人值守式设备使用的,比如家用的路由器等等类似设备,所以客户端只需要被动接受就可以了;反之,因为并没有身份验证机制,若使客户端有权利更新服务端的文件,那岂非很危险?
2. 最新版本的netkite内部维护一个哈希表,这样能保证同样的模块只获取一次,以后的忽略,这样为个性化定制提供了可能;至于兄台给出的结构图,只能是规划不合理,具体能更新到哪个C模块,只有天知道 :)
3. 过去的版本在Debian下编译有问题,在0.9.1.327版本已经修复,现在最新的版本是0.9.2.332.
贴出一个我实际应用中的目录结构图,已作参考
我在实际中使用情况,最终得模块节点实际上是每一台机器的序列号(S2D070100001),里面放的是各自不同的更新文件,而公共的文件放在顶层或最顶层.
对于模块S2C061200001来说,他有2个名为S010httpd的文件都可以更新到,但其中一个是他自身定制的文件netkite/root/1.5/chinese/jsp/S2C061200001/S010httpd,这样,就不会更新公共的netkite/root/1.5/chinese/S010httpd (当然,是在overlap mode关闭时,详细见netkite -h).
[binary@smbddns var]$ find netkite
netkite/
netkite/root/
netkite/root/1.5/
netkite/root/1.5/english/
netkite/root/1.5/english/S2D070100001/
netkite/root/1.5/english/S2D070100002/
netkite/root/1.5/chinese/
netkite/root/1.5/chinese/asp/
netkite/root/1.5/chinese/asp/S2B061200001/
netkite/root/1.5/chinese/asp/S2A061200001/
netkite/root/1.5/chinese/asp/S2B061200002/
netkite/root/1.5/chinese/asp/S2B061200003/
netkite/root/1.5/chinese/asp/S2B061200004/
netkite/root/1.5/chinese/asp/S2B070100001/
netkite/root/1.5/chinese/asp/S2B070300001/
netkite/root/1.5/chinese/asp/S2B070400001/
netkite/root/1.5/chinese/php/
netkite/root/1.5/chinese/php/S2C070400001/
netkite/root/1.5/chinese/php/S2C070400002/
netkite/root/1.5/chinese/jsp/
netkite/root/1.5/chinese/jsp/S2C061200001/S010httpd
netkite/root/1.5/chinese/jsp/S2C061200001/S010httpd.rule
netkite/root/1.5/chinese/S010httpd
netkite/root/1.5/chinese/S010httpd.rule
netkite/root/1.5/chinese/S095isoqlog
netkite/root/1.5/chinese/S095isoqlog.rule
最后,在此贴出完整的ChangeLog,另,原来的链接依然有效:
[url=http://sourceforge.net/projects/netkite]http://sourceforge.net/projects/netkite
0.9.2.332
==============
* fix an invalid point in calmd5.
* add a rule, then you can write "md5 = xxx" in the rule file to avoid the dynamic file verification.
0.9.1.328
==============
- fixed some libraries' behavior, which are inessential.
0.9.1.327
==============
* fixed a compile error in debian.
0.9.1.325
==============
* add overlap mode, now have correct inherit relation.
- change the function name and argument in the mdc library.
- change -h and -H infomation( about overlap mode ).
- change man page( about overlap mode ).
0.9.0.315
==============
* insert a respond at serial send/recv protocol version and module name.
that mean not compatible previous version.
* after the temp file receiving completed, the client blocks all signals
when replacing the destination file.
- initialize the m_sock when construct the tcpbase object.
- fix the man page some error.
0.8.2.309
==============
* correct the respond error caused by the timeout of verify message digest.
* client log add finish information.
* modify the man page, add the finish description.
- fix parse library function trim prototype with static, i'm forget last time :(
- logger library has small-beer change.
0.8.1.305
==============
* check whether the file name start with '/', if not, add it.
* fix the abnormal return when client without the device specify by server
- close the screen error informations and redirect them to log.
- fix parse library function trim prototype with static.
0.8.0.299
==============
- initialize a struct statfs in netkite.cpp.
- fix some nameing rules.
0.8.0.298
==============
first times released.
[ 本帖最后由 isnowran 于 2007-6-18 13:59 编辑 ]
netkite-0.9.2-pre1.tar.gz
|