免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 7880 | 回复: 17
打印 上一主题 下一主题

自定义升级系统 netkite [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-10-05 01:26 |只看该作者 |倒序浏览
这是第二次发布,与前一次相比,架构已经完全不同了,请大家试用,有任何问题,请告诉我,谢谢
附件是源码,如有需要,可以到这里下载、查看其他相关信息
http://sourceforge.net/projects/netkite

我把man贴出来便于大家快速检索
BTW, 感谢mq100, flw教我制作man的方法, 这个就是flw的pod2man方法生成的man,相当好用:)


  1. NAME
  2.     netkite - custom upgrade system

  3. SYNOPSIS
  4.     netkite [HOST] [OPTIONS]

  5. DESCRIPTION
  6.     Netkite is a network upgrade system that integrates the server and the
  7.     client. It can be used in system patching. Support all the file types of
  8.     linux.

  9.     Each directory under the root of the server is called a module, the
  10.     files included in which can be gotten by the client; the module is
  11.     inheritable.

  12.     The client specifies a module name when connecting to the server, and
  13.     checks with md5 sum whether the files in the received module require
  14.     upgrade.

  15.     With the rule file corresponded to the upgrade file, the server controls
  16.     the client’s behavior of upgrade, which include four actions such as
  17.     creating and deleting. Rule file, which suffix is .rule, is in the same
  18.     directory and with the same name as upgrade file. Refer to relevant
  19.     description for the rules of config file and detailed examples. eg: the
  20.     directory structure is as follows:

  21.             root/
  22.              l- module_a/
  23.              l- father/
  24.                  l- file1
  25.                  l- file1.rule
  26.                  l- son
  27.                      l- file2
  28.                      l- file2.rule

  29.     If the client specifies module father, the server will deliver file1 to
  30.     the client and trace back to root, then the communication ends; if the
  31.     client specifies module son, the server will first deliver file2 to the
  32.     client. son is inherited from father, then the server will deliver file1
  33.     to the client. Create necessary paths if it inexistent after getting
  34.     files.

  35.     The default parameter of the client operates only for once, or the
  36.     operation can be circulated by changing the parameter. During the
  37.     circulation, signal SIGALRM can help compel the client to start a new
  38.     connection.

  39.     If the command line parameter is the same as the config file’s, then it
  40.     has high PRI.

  41. OPTIONS
  42.     The command line parameters shall be in one-to-one correspondence with
  43.     the ones of config file; refer to CONFIG FILE for the default value of
  44.     options.

  45.     -p *port* specify communication port

  46.     -t *second* set the timeout in seconds

  47.     -x *logfile* specify the absolute path of log file

  48.     -f *conf* sepcify config file

  49.     -r *root* specify the absolute path of root directory for server

  50.     -b *backlog* set listening backlog for server

  51.     -d *second* indicate executive cycle for client

  52.     -m *module* specify a name of accepted module for client

  53.     -X *tmp* specify the absolute path of tmp directory for client

  54.     -s switch to server mode

  55.     -c switch to client mode, default

  56.     -v print current version

  57.     -h print this help page

  58.     -H print config file help page

  59.     -g turn off log record

  60.     -G turn on log record, default

  61.     -o display available configuration

  62. RULE FILE
  63.   NAMING
  64.     With the suffix .rule, it is in the same directory and with the same
  65.     name as upgrade file.

  66.   FORMAT
  67.     Each line of rule file is either a comment or a directive. A Comment
  68.     line starts with a # and is ignored. A directive line has the format:

  69.     key = value

  70.     The valid key and its value are:

  71.     name = /root/file The position and name of the direction upgrade file
  72.     stored in the client.

  73.      = /root/dir/ Since directory is explained as the module name, if an
  74.     empty directory will be provided for the client, then add a slash behind
  75.     the file.

  76.     act = create The act of direction file upgrade, if it is not specified,
  77.     default it as create. Get the different files from the server no matter
  78.     whether a file or directly exists in the name specified position or not.

  79.      = remove Remove the file or directly existing in the name specified
  80.     position; if the directory exists, it shall be empty.

  81.      = update Update the file or directory if existing; if the directory
  82.     exists in the name specified position, it shall be empty.

  83.      = unique Update from the server only if no file or directory exists in
  84.     the name specified position.

  85.     dev = /dev/hdb1 Which device dose the direction file exist in; if it is
  86.     not specified, default it as in system current directory structure, it
  87.     is the most commonly used measuree.

  88. CONFIG FILE
  89.     The default config file is /etc/netkite.conf, the format is like RULE
  90.     FILE. Type "netkite -H" to print following contents; and original config
  91.     file can be generated though the redirection to file.

  92.             # specify remote the server address in the client mode
  93.               address = 127.0.0.1
  94.         
  95.             # specify listening network interface in the server mode
  96.               interface = 0.0.0.0
  97.         
  98.             # switch to the server or the client mode
  99.               the server_mode = no
  100.         
  101.             # turn on/off log record
  102.               log_enable = yes
  103.         
  104.             # specify communication port
  105.               port = 7002
  106.         
  107.             # set the timeout in seconds
  108.               timeout = 75
  109.         
  110.             # specify the absolute path of log file
  111.               log_file = /var/log/netkite.log
  112.         
  113.             # specify the absolute path of root directory for the server
  114.               root = /var/netkite
  115.         
  116.             # set listening backlog for the server
  117.               backlog = 1024
  118.         
  119.             # indicate executive cycle for the client,
  120.               # if 0, then run one time only
  121.               idle = 0
  122.         
  123.             # specify a name of accepted module for the client
  124.               module = test
  125.         
  126.             # specify the absolute path of tmp directory for the client
  127.               tmp_path = /tmp
  128.         
  129. EXAMPLES
  130.   In the server mode
  131.         At first, netkite will chroot to root, then create this directory in
  132.         case it does not already exist.

  133.     1.  Create the server root directory /var/netkite:

  134.             sh-2.05b# mkdir /var/netkite
  135.                
  136.     2.  Create test module father and son:

  137.             sh-2.05b# mkdir /var/netkite/father
  138.             sh-2.05b# mkdir /var/netkite/father/son
  139.                
  140.     3.  Put test file to father and son

  141.             sh-2.05b# echo "hello" > /var/netkite/father/regular
  142.             sh-2.05b# echo "hello" > /var/netkite/father/dir
  143.             sh-2.05b# ln -s /root /var/netkite/father/son/link
  144.                         
  145.     4.  Create rule file for upgrade file as follows:

  146.             sh-2.05b# cat /var/netkite/father/regular.rule
  147.             name = /misc/test1
  148.             act = create

  149.             sh-2.05b# cat /var/netkite/father/dir.rule
  150.             name = /misc/test2/

  151.             sh-2.05b# cat /var/netkite/father/son/link.rule
  152.             name = /misc/test3
  153.             dev = /dev/hdb1

  154.     5.  Execute netkite in server mode:

  155.             sh-2.05b# netkite -s

  156.   In the client mode
  157.     a.  Specify the accepted module name as father and the ip address
  158.         10.0.0.1 of the server, and execute netkite:

  159.             sh-2.05b# netkite 10.0.0.1 -m father
  160.                         
  161.         The client gets file regular and empty directory dir from the
  162.         server, which be stored in /misc/; then regular is named as test1
  163.         and dir test2. If no /misc/ exists, the client will create it.

  164.     b.  Specify the accepted module name as son:

  165.             sh-2.05b# netkite 10.0.0.1 -m son

  166.         The client gets symbol link link and stores it in /misc/ under
  167.         partition /dev/hdb1, naming it as test3. Due to the inheritable
  168.         relation between the modules, the two files in father will also be
  169.         got later.

  170. LOG FORMAT
  171.   The server
  172.     return_code state_info client_addr [module name] transmit_file_name

  173.   The client
  174.     return_code state_info action_info device_name->receive_file_name

  175.     Note: 1. Action_info includes three states:

  176.             upgrade:
  177.                 The content of file is modified.
  178.             
  179.             change:
  180.                 The attribute of file is changed.
  181.             
  182.             remove:
  183.                 The file is removed.
  184.    
  185.         2. If dev is not specified in rule file, device_name will not appear in log file.
  186.    
  187. FILES
  188.     /etc/netkite.conf Default config file.

  189.     /var/netkite Default root directory of the server.

  190.     /var/log/netkite.log Default Log file.

  191.     /tmp Default temp file directory of the client.

  192. BUGS
  193.     1.  If no dependence relation between upgrade files exists, the demand
  194.         for this shall be realized by the feature that child module takes
  195.         precedence of father module.

  196.     2.  Considering the security, the removal of non-empty directory is not
  197.         supported now.

  198.     3.  The server does not log the files removed by the client.

  199.     Bug report to <binary@eniak.org>.
复制代码

[ 本帖最后由 isnowran 于 2006-11-17 14:46 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2006-10-05 01:32 |只看该作者
rsync相比,这个还差一点

论坛徽章:
0
3 [报告]
发表于 2006-10-05 08:23 |只看该作者
嘿嘿,鼓励人家一下也好嘛,写代码、写程序,不是那么容易的

论坛徽章:
38
2017金鸡报晓
日期:2017-02-08 10:39:4215-16赛季CBA联赛之深圳
日期:2023-02-16 14:39:0220周年集字徽章-年
日期:2022-08-31 14:25:28黑曼巴
日期:2022-08-17 18:57:0919周年集字徽章-年
日期:2022-04-25 13:02:5920周年集字徽章-20	
日期:2022-03-29 11:10:4620周年集字徽章-年
日期:2022-03-14 22:35:1820周年集字徽章-周	
日期:2022-03-09 12:51:3220周年集字徽章-年
日期:2022-02-10 13:13:4420周年集字徽章-周	
日期:2022-02-03 12:09:4420周年集字徽章-20	
日期:2022-01-25 20:14:2720周年集字徽章-周	
日期:2022-01-13 15:12:33
4 [报告]
发表于 2006-10-05 09:45 |只看该作者
鼓励,我也有个项目在SF。

论坛徽章:
0
5 [报告]
发表于 2006-10-05 16:53 |只看该作者
原帖由 moyuhappy 于 2006-10-5 01:32 发表
rsync相比,这个还差一点

谢谢各位的鼓励与支持,非常感谢!

说明一下,它与rsync是无法相比的,不是一个数量级的程序:)
但是,与rsync的策略有所不同,如图所示:

  1. rsync:
  2.         server                client
  3.           |- dirA               |- dirA
  4.               |- file_1             |- file_1
  5.               |- file_2             |- file_2
  6.               |- file_3             |- file_3
  7.                                     
  8. netkite:
  9.         server                client
  10.           |- dirA               |- dirC
  11.               |- file_1         |    |- file_1
  12.               |- file_2         |
  13.               |- file_3         |- dirD
  14.                                 |    |- file_2
  15.                                 |
  16.                                 |- /dev/hdb1/dirE
  17.                                      |- file_3
复制代码

rsync的主要的用途是同步,也就是把服务端的目录结构原样搬移到客户端某个目录下;
netkite的主要用途是修补,也就是说,把某个目录作为一个发布源,客户端指定一个源目录(模块),来修补客户端的整个根目录结构每一个需要修补的文件,并且不局限于当前目录结构,也可以是客户端当前未挂载的有效设备

论坛徽章:
0
6 [报告]
发表于 2006-10-06 16:04 |只看该作者
试试

论坛徽章:
0
7 [报告]
发表于 2006-10-08 23:56 |只看该作者
另外,对其他发行版不熟悉,我只在redhat和ubuntu下测试过,如果有哪位朋友有其他的系统,请帮我测试一下安装以及运行,谢谢!

论坛徽章:
0
8 [报告]
发表于 2006-11-17 14:43 |只看该作者
netkite-0.8.1-pre1 发布,欢迎大家试用,期待大家的意见及建议,谢谢。
ChangeLog

  1. 0.8.1.305
  2. ==============
  3. * check whether the file name start with '/', if not, add it.
  4. * fix the abnormal return when client without the device specify by server
  5. - close the screen error informations and redirect them to log.
  6. - fix parse library function trim prototype with static.

  7. 0.8.0.299
  8. ==============
  9. - initialize a struct statfs in netkite.cpp.
  10. - fix some nameing rules.

  11. 0.8.0.298
  12. ==============
  13. first times released.
复制代码

论坛徽章:
0
9 [报告]
发表于 2006-12-15 03:22 |只看该作者
netkite-0.8.2-pre1 发布,主要改动
1. 修正了一个由于交验大文件引起超时后的应答错误
2. 客户端日志增加完成标记
3. 其他一些细微改动

netkite-0.8.2-pre1.tar.gz

94.25 KB, 下载次数: 146

论坛徽章:
0
10 [报告]
发表于 2006-12-15 08:09 |只看该作者
非常好,非常正规!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP