makeself 制作自解压压缩包

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

Read More:

  • No related posts

7 Comments

  1. 1 hmy Commented @ 2009-01-06 14:44Reply to this comment

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

  2. 2 Toy Commented @ 2009-01-06 15:02Reply to this comment

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

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

  3. 3 yhlfh Commented @ 2009-01-06 16:07Reply to this comment

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

  4. 4 hmy Commented @ 2009-01-06 17:32Reply to this comment

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

  5. 5 fcicq Commented @ 2009-01-06 19:32Reply 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:28Reply 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:18Reply to this comment

    和checkinstall差不多啊