LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2741|回复: 36

E17自动安装脚本

[复制链接]
发表于 2005-11-8 13:11:44 | 显示全部楼层 |阅读模式
功能:
自动从CVS check out
自动生成deb包
自动安装生成的deb包

如果不是使用debian包的
可以修改这里


  1. #if you don't use deb,then you can call these two line
  2. #system('./autogen.sh --prefix=/usr;make;make uninstall;make install');
  3. #return ;
复制代码

把这三行前面的#去掉 这样就会自动把e17安装到/usr目录下


增加了CVS中check out功能
使一切全部自动化
只需要保存成inse17.pl
然后在这个目录下执行perl inse17.pl就会自动执行
对于debian 需要安装一些相关的程序
如fakeroot
还有下面是编译时必须的
m4
autoconf
automake (1.7 or greater)
libtool
pkg-config
texinfo
gettext
另外编译ecore时需要libxcursor-dev 不然link时会出错 注意了


  1. #!/usr/bin/perl
  2. #
  3. use strict;
  4. use FileHandle;

  5. my  $logfilehandle  = new FileHandle ">e17install.log";
  6. my  $autobuilddir   = 1;#if true,then auto build all directory
  7. my  $autobuild            = 1;#   if true,auto build all packages in a directory

  8. my @compileobjs        =(
  9.                   ['e17/libs','../..',
  10.                   'edb',
  11.                   'eet',
  12.                   'imlib2',
  13.                   'imlib2_loaders',
  14.                   'evas',
  15.                   'ecore',
  16.                   'edje',
  17.                   'epeg',
  18.                   'epsilon',
  19.                   'embryo',
  20.                   'esmart',
  21.                   'emotion',
  22.                   'ewl',
  23.                   'engrave'],
  24.                   ['e17/apps','../..',
  25.                   'e',
  26.                   'e_utils',
  27.                   'entice',
  28. #'entrance',
  29.                   'eclair',
  30.                   'elicit',
  31. #'erss',
  32.                   'examine'
  33. #'iconbar',
  34. #'e_modules'
  35.                   ],
  36.                   ['misc','..',
  37.                   'engage']
  38. );

  39. print   "get CVS source code\n";
  40. print   "login CVS:,when need you input password,press return directly\n";
  41. print   'cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/enlightenment login'."\n";
  42. system('cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/enlightenment login');
  43. print   'chech out E17:'."\n";
  44. print   'cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/enlightenment co e17'."\n";
  45. system('cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/enlightenment co e17');
  46. print   'chech out Misc:'."\n";
  47. print   'cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/enlightenment co misc'."\n";
  48. system('cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/enlightenment co misc');

  49. print   "start build debian packages\n\n";

  50. my $objs;
  51. foreach $objs (@compileobjs){
  52.     my        @objarray   = @$objs;
  53.     my        $dir            = shift(@objarray);
  54.     my        $back_dir   = shift(@objarray);
  55.     if( ! -d $dir ){
  56.         print "dir:$dir not exist,will skip compile it\n";
  57.         next;
  58.     }
  59.     next if( (!$autobuilddir)
  60.                  && (!choseact("are you want to build dir:$dir\n")) );

  61.     print   "start parse:<<<<<        $dir  >>>>>: back:$back_dir\n";
  62.     chdir $dir;
  63.     system('rm -f *.deb *.dsc *.tar.gz *.changes');

  64.     my        $subdir;
  65.     foreach $subdir (@objarray){
  66.         if( !(-d $subdir) ){
  67.             print "dir:$subdir not exist,skip compile it\n";
  68.             next;
  69.         }
  70.         print        "\n\nenter directory:".$subdir."\n";
  71.         chdir($subdir);
  72.         parsedir($subdir);
  73.         $logfilehandle->autoflush(1);
  74.         print "\n";
  75.         $logfilehandle->autoflush(0);
  76.         chdir("../");
  77.         system('rm -f *.dsc *.tar.gz *.changes');
  78.     }
  79.     chdir $back_dir;
  80. }
  81. close($logfilehandle);




  82. sub parsedir()
  83. {
  84.     my $pkg        = $_[0];
  85.     return if((!$autobuild) && (!choseact("are you want to build:$pkg\n")) );
  86.     my $curpwd        = qx(pwd);
  87.     chomp($curpwd);
  88.     print "\tcur dir is:\n\t$curpwd\n";
  89.     print "\trun:   dpkg-buildpackage -us -uc -rfakeroot 2>&1\n";
  90.     print $logfilehandle "\n\t\tcur dir is:\n\t$curpwd\n";
  91.     chmod 755,'debian/rules' if(! -x 'debian/rules');
  92.     chmod 755,'autogen.sh' if(! -x 'autogen.sh');

  93. #if you don't use deb,then you can call these two line
  94. #system('./autogen.sh --prefix=/usr;make;make uninstall;make install');
  95. #return ;
  96.     system("make distclean >/dev/null 2>&1");
  97.     system('cp debian/changelog.in debian/changelog >/dev/null 2>&1') if(! -f 'debian/changelog');

  98.     open(MAKEFI,"dpkg-buildpackage -us -uc -rfakeroot 2>&1|") || die "exec fail\n";
  99.     print $logfilehandle 'dpkg-buildpackage -us -uc -rfakeroot 2>&1'."\n";

  100.     my @pkgs;
  101.     my $line;
  102.     print   "\n";
  103.     while($line=<MAKEFI>){
  104.         print $logfilehandle $line;
  105.         print $line if($line=~m/\berror\b/i);
  106.         next if($line!~m/dpkg\-deb:\s+building\s+package\s+\`([^']+)\'\s+in\s+\`([^']+)\'/);

  107.         print "\tpkg:[$1:\t$2]\n";
  108.         push(@pkgs,$2);
  109.     }
  110.     close(MAKEFI);

  111.     if($#pkgs < 0){
  112.         print "error no package found,build message is write to e17install.log file\n";
  113.         print $logfilehandle "error no package found,please check build message\n";
  114.     }
  115.     else{
  116.         my $pkgfile = join(" ",@pkgs);
  117.         print  "\n>>>>>>>>>\n\tdpkg -i $pkgfile\n\n";
  118.         system("dpkg -i $pkgfile");
  119.     }
  120.     print "\n";
  121. }

  122. sub choseact()
  123. {
  124.     print $_[0]."\nplease input yes or no [Y]\n";
  125.     my $in=<STDIN>;
  126.     if($in=~m/n/i){
  127.         print "cancel\n";
  128.         return 0;
  129.     }
  130.     print "\n";
  131.     return 1;
  132. }


复制代码
 楼主| 发表于 2005-11-8 13:48:24 | 显示全部楼层
E17的新闻在这里
http://get-e.org/Main/News/index.html

增加了全屏模式 还有增加了mount 模块 可以方便的在桌面上选择需要mount的设备(如移动硬盘等 点一下就可以mount 再点一下就会umount 很方便 )

还有其它更新
回复 支持 反对

使用道具 举报

发表于 2005-11-8 19:28:00 | 显示全部楼层
wzp@ubuntu:~$ sudo ./inse17.pl
Global symbol "@cvs" requires explicit package name at ./inse17.pl line 44.
Global symbol "@cvs" requires explicit package name at ./inse17.pl line 47.
Global symbol "@cvs" requires explicit package name at ./inse17.pl line 50.
Execution of ./inse17.pl aborted due to compilation errors.
回复 支持 反对

使用道具 举报

发表于 2005-11-8 19:34:37 | 显示全部楼层
wzp@ubuntu:~$ perl inse17.pl
Global symbol "@cvs" requires explicit package name at inse17.pl line 44.
Global symbol "@cvs" requires explicit package name at inse17.pl line 47.
Global symbol "@cvs" requires explicit package name at inse17.pl line 50.
Execution of inse17.pl aborted due to compilation errors.
不行啊
回复 支持 反对

使用道具 举报

发表于 2005-11-8 19:54:05 | 显示全部楼层
@cvs前面加一反斜杠("\")
回复 支持 反对

使用道具 举报

发表于 2005-11-8 22:20:18 | 显示全部楼层
好像FileHandle没有deb包阿
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-11-8 22:41:45 | 显示全部楼层
谢谢

因为家里没有上网所以没有在linux上试过

Filehandle是perl包里面有的

你的perl报错吗
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-11-8 22:47:38 | 显示全部楼层
改过了 谢谢Georock 指出错误及henryouly提出方法
回复 支持 反对

使用道具 举报

发表于 2005-11-8 23:27:34 | 显示全部楼层
哦,我搞错了,FileHandle是有的,不过还是跑不了

enter directory:edb
    cur dir is:
    /home/lcm/tmp/e17/libs/edb
    run:   dpkg-buildpackage -us -uc -rfakeroot 2>&1
Can't use an undefined value as a symbol reference at ./inse17.pl line 101.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-11-9 14:25:06 | 显示全部楼层
把这行
my  $logfilehandle  = new FileHandle ">e17install.log";

修改成
my  $logfilehandle  = new FileHandle ">e17install.log" ;
die "open log file fail\n" if undef $logfilehandle;



可能是无法产生log文件引起的

或是把所有出现logfilehandle的行都去掉
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表