Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create executable bin installation files under Linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to create executable bin installation files under Linux", the content is easy to understand, clear, hope to help you solve your doubts, the following let Xiaobian lead you to study and learn "how to create executable bin installation files under Linux" this article.

The .bin file is a self-executing file on Linux and Unix-like operating systems. Before executing the .bin file, you need to give it execution permission. This can be done from the command line or gui.

Implementation method 1. This paper takes installing ftp command in Redhat system as an example to illustrate how to integrate the installation script and installation media into one file to simplify the operation.

First, write a script that contains the installation commands.

#! / bin/sh echo "Hello World" dir_installation=/root/create_bin sed-n-e '1Magi / ^ exit 0 $/! p' $0 > "${dir_installation} / ftp-0.17-54.el6.x86_64.rpm" 2 > / dev/null cd $dir_installation rpm-ivh ftp-0.17-54.el6.x86_64.rpm rm ftp-0.17-54.el6.x86_64.rpm exit 0 Note: the key to this script is sed He will extract the contents after exit 0, save it as a rpm package, then perform the installation, and delete the rpm after the installation is complete.

Finally, we use the cat command to generate a new file for the script and installation package.

At this time, if you use the file command to view the install-rpm.bin file, you can find its type or text type, open with the vim editor, you can still see the content of the script, you can also modify it.

2. For the need for the second hidden code content, there is a tool called shc, which can be used to program scripts into binaries.

The use of shc is relatively simple. After download, make generates an executable file, and then encrypts the script directly, resulting in two files. One ends with .x and is an executable binary. The other ends with .x.c and is the generated intermediate c file. Shc can also specify the expiration time of executable scripts.

Wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz tar xvfz shc-3.8.9b.tgz cd shc-3.8.9b make. / shc- v shc parse (- f): No source file specified shc Usage: shc [- e date] [- m addr] [- I iopt] [- x cmnd] [- l lopt] [- rvDTCAh]-f script. / shc- f install-rpm.bin Shc can compile script files into binary files The content of the script is hidden, and it is impossible for ordinary users to view and modify it.

The above is all the contents of the article "how to create an executable bin installation file under Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report