makeself 制作自解压压缩包

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

makeself 制作自解压压缩包

<script type="text/javascript"><!-- google_ad_client = "pub-9432205671574187"; //LT, 300x250 google_ad_slot = "9869120281"; google_ad_width = 300; google_ad_height = 250; //--></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差不多啊

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值