如何在 LINUX 中创建自我可执行存档文件?在任何操作系统中创建 Makeself 自可执行文件的步骤是什么? [英] How create Makeself self executable archive file in LINUX? What is the steps to create Makeself self executable file in any Operating System?
问题描述
我想使用 Makeself 创建一个可自我执行的档案.我提到了 makeself.io 但对它没有任何理解.制作Makeself自执行档案的步骤是什么?
I want to create a self-executable archive using Makeself. I referred to makeself.io but didn't understand anything from it. What are the steps for making a Makeself self-executable archive?
如果我在任何操作系统上运行这个可执行文件,那么它应该可以工作并完成我需要的任务.
If I run this executable on any operating system then it should be work and do my required task.
推荐答案
这里我给出了将 UBUNTU ISO 归档到自可执行归档中的示例.(这仅适用于理解)
Here I am giving example of archiving UBUNTU ISO in self executable archive. (This is only for understanding)
1.首先下载makeself到您的机器中.
1.First download makeself into your machine.
apt install makeself
OR
您可以从官方网站下载makeself或者按这里然后您将获得makeself-2.4.0.run 的文件名.只需通过 ./makeself-2.4.0.run
运行这个文件.它将自动创建一个名为 makeself-2.4.0 的目录.
You could download makeself from official website Or Press here
Then you will get file names as makeself-2.4.0.run.
Simply run this file by ./makeself-2.4.0.run
.
It will automatically create one directory named as makeself-2.4.0.
- 在该目录中,您将获得 makeself.sh 脚本.这是您的直接可执行脚本.您可以使用此文件代替
apt install makeself.
2.然后创建一个目录,您要存档.
mkdir ISO
3.然后在此目录中复制您的ISO文件.
3.Then copy your ISO file in this directory.
cp <Source Path> <Destination Path> // Here destination path is ISO
4.然后创建一个名为copy.sh
vim Copy.sh
在这个脚本里面写下你想用这个 ISO 做什么.所以我想将此 ISO 复制到我的/home/Downloads 文件夹中.所以我用脚本写
Inside this script write what you want to do with this ISO. SO I want to copy this ISO into my /home/Downloads folder. So I write in script
#!/bin/bash
cp -r <filename> /home/Downloads
echo "File Copied Successfully"
##// Remember This script will automatically run after extracting this folder //
给脚本权限
chmod 777 Copy.sh
然后
cd ..
所以现在你有 1 个 ISO 目录,在那个目录中有 1 个 ISO(UBUNTU iso)文件和 1 个脚本(Copy.sh).
So now you have 1 ISO directory and in that directory 1 ISO(UBUNTU iso) file and 1 script(Copy.sh).
5.现在运行这个命令
makeself --pbzip2 ISO Copy_ISO.run "Copying ISO File" ./Copy.sh
这里,
- pbzip2 --- 使用 pbzip2 代替 gzip 在具有多个 CPU.(您可以使用此处中提到的任何压缩算法)
- ISO ---它是包含要归档的文件的目录的名称
- Copy_ISO.run --- 这是要创建的存档的名称
- "Copying ISO File" --- 它是一个描述包的任意文本字符串.这将是提取文件时显示.
- ./Copy.sh ---它是startup_script.它是要从目录中执行的命令提取的文件.
- pbzip2 --- Use pbzip2 instead of gzip for better and faster compression on machines having multiple CPUs. (you can use any zipping algorithm mentioned in here)
- ISO --- It is the name of the directory that contains the files to be archived
- Copy_ISO.run --- It is the name of the archive to be created
- "Copying ISO File" --- It is an arbitrary text string describing the package. It will be displayed while extracting the files.
- ./Copy.sh --- It is startup_script. It is the command to be executed from within the directory of extracted files.
它将生成Copy_ISO.run文件.
因此您可以在任何系统上运行这个Copy_ISO.run文件.
So you can run this Copy_ISO.run file on any system.
6.要运行的命令是-->
6.Command to run is -->
./Copy_ISO.run
这将复制您在/home/目录中的UBUNTU ISO文件.您可以在任何系统上运行此脚本.您无需再携带 UBUNTU ISO 的 zip 文件.
This will copy your UBUNTU ISO file in /home/ directory. You can run this script on any system. You don't need to carry another zip file of UBUNTU ISO.
这篇关于如何在 LINUX 中创建自我可执行存档文件?在任何操作系统中创建 Makeself 自可执行文件的步骤是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!