makeself 制作自解压压缩包

来源:互联网 发布:校园招聘java 简历模板 编辑:程序博客网 时间:2024/05/08 22:40

原贴:http://linuxtoy.org/archives/makeself.html

makeself 制作自解压压缩包

<script type="text/javascript">&lt;!--google_ad_client = "pub-9432205671574187";//LT, 300x250google_ad_slot = "9869120281";google_ad_width = 300;google_ad_height = 250;//--&gt;</script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script><script src="http://googleads.g.doubleclick.net/pagead/test_domain.js"></script><script>window.google_render_ad();</script>

Google Earth for Linux 就是利用该软件制作的自解压包。假如你手上有 Nginx 的源代码包 nginx.tgz,你想做成类似 Google Earth 那种一次执行就自动安装的包,那么利用 makeself 可以轻松实现。

建立一个临时目录 nginx,把 nginx.tgz 放在里面,然后在该目录里面写一个 shell,名为 init.sh,内容如下:

#!/bin/bash
tar zxpf nginx.tgz -C /tmp/
cd /tmp/nginx
./configure --prefix=/tmp/nginxtest
make
make install

然后在 nginx 目录上层目录执行下面的命令:

# makeself nginx nginx.bin nginx ./init.sh

那么就会把 nginx 目录打包成 nginx.bin。执行 nginx.bin 会自己把自己解压到一个临时目录,然后自动执行 init.sh。有兴趣的同学自己去试吧!

makeself

署名 • 注明出处 • 非商业性使用

7 Comments

  1. 1 hmy Commented @ 2009-01-06 2:44 pmReply to this comment

    怎么全部显示出来了,麻烦linuxtoy自己处理修改下吧

  2. 2 Toy Commented @ 2009-01-06 3:02 pmReply to this comment

    @hmy: 只要在适当位置(通常是第一段末尾)加入 <!--more--> 就可以了。请见:

    http://linuxtoy.org/faq/style-guide

  3. 3 yhlfh Commented @ 2009-01-06 4:07 pmReply to this comment

    这种包包安装是方便了,可是卸载呢?

  4. 4 hmy Commented @ 2009-01-06 5:32 pmReply to this comment

    可以考虑弄到一个独立的目录,然后自己再写一个uninstall 脚本删除该目录

  5. 5 fcicq Commented @ 2009-01-06 7:32 pmReply to this comment

    嘘… Gentoo 用户可以 src2pkg.sh [URL to tar file], 直接安装, 用正常的方法卸载…
    http://linuxtoy.org/archives/which-distro.html#comment-99710

  6. 6 walkerxk Commented @ 2009-01-07 9:28 amReply to this comment

    不用这么麻烦,在文件前面加上一段代码就能自解压了:
    #!/bin/bash
    sed ‘1,/^#script end/d’ $0>b.tar.gz
    tar zxf b.tar.gz
    rm b.tar.gz
    exit
    #script end
    如果怕重名,就改到/tmp下面。
    realplay什么的bin文件都是这样打包的。

  7. 7 lance Commented @ 2009-01-07 10:18 amReply to this comment

    和checkinstall差不多啊

 

原创粉丝点击