linux下使用makeself制作一键安装包

如何使用makeself制作一键安装包

1. 下载makeself


[root@mp tmp]# wget http://cdn.megastep.org/makeself/makeself-2.2.0.run
[root@mp tmp]# chmod +x makeself-2.2.0.run 
[root@mp tmp]# ./makeself-2.2.0.run 

2. 例子

- 目录

[root@mp tmp]# ls -R ms-sample/
ms-sample/:
installDetail.sh  install.sh

- install.sh
[root@mp tmp]# cat install.sh 
#!/bin/bash  
echo "installing my software"   
read -p "Press the ENTER key to continue." enterContinue  
  
echo "************************************************************************"  
echo " Installing Package..."  
echo "************************************************************************"  
. ./installDetail.sh 

- installDetail.sh

[root@mp tmp]# cat installDetail.sh 
    #!/bin/bash  
    DIST_NAME=`lsb_release -ds 2>/dev/null || cat /etc/*release 2>/dev/null | head -n1`  
    echo "OS="$DIST_NAME  
    echo "here is installDetail" 
    

3. 制作mstest.run

命令格式:./makeself.sh 要压缩的文件夹 生成的文件名 描述信息 第一个执行的脚本


[root@mp tmp]# ./makeself-2.4.0/makeself.sh ms-sample mstest.run "This is mstest installer" ./install.sh
Header is 587 lines long

About to compress 12 KB of data...
Adding files to archive named "mstest.run"...
./
./install.sh
./installDetail.sh
CRC: 3283785211
MD5: f45a2c7d3d6856c1cb6ff54f5db1fd49

Self-extractable archive "mstest.run" successfully created.


4. 运行测试

[root@mp tmp]# ./mstest.run 
Verifying archive integrity...  100%   All good.
Uncompressing This is mstest installer  100%  
installing my software
Press the ENTER key to continue.
************************************************************************
 Installing Package...
************************************************************************
OS=CentOS release 6.9 (Final)
here is installDetail

猜你喜欢

转载自blog.csdn.net/zyjtx321/article/details/106519227