A Linux installation file
Linux is a common installation for Tar,zip,gz,rpm,deb,bin and so on. We can simply divide into three categories,
First: Packaging or Compressed Files Tar,zip,gz, general decompression can be, or after decompression run SH file;
Second: the corresponding management tools deb,rpm, etc., usually such installation files can be installed through a third-party command line or UI simple installation, such as apt in Ubuntu to install Deb,redhat in the Yum to install RPM;
Third: Like the. Bin class, is actually the SH and zip packaged as bin, or the SH and rpm packaged as bin, etc., when the command line to run the bin installation file, is actually the bin inside the SH to extract the bin zip or install the RPM process;
Two. bin installation files
The. bin installation file can be considered as a packaging form for SH files and other installation files such as Zip or RPM. Such as:
Advantages of the. Bin installation file:
1) Only one package is the. bin file;
2) can be run directly on Linux, because he is sh (his first half is sh);
3) in the SH can contain the required user to receive the protocol information, and prompts the user to receive, if the user does not receive, installation exit;
Three. bin installation File Execution
1) Super simple: sh xxxx.bin or direct xxxx.bin.
2) The process is as follows:
Four. bin installation file making
1) composed of SH file (example: Yyyy.bin)
#!/Bin/Sh
PATH=/Usr/Bin/Bin
Umask022
Echo_args="-E"
Localinstall=$1
More<<"Eof"
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Eof
Agreed=
While [x$Agreed=X]; Do
Echo
Echo"Agree to the above license terms? [Yes or No]"
Read Reply leftover
Case$Reply in
y* | y*)
Agreed=1;;
n | N)
Echo"If you don ' t agree to the license you can ' t install this software";
Exit1;;
Esac
Done
If[-D"$localinstall"];Then
Outname=$Localinstall/Outname
Else
Outname=Outname
Fi
Echo"Unpacking ..."
Tail-n+Aaa $0>$Outname
If[-X/Usr/Bin/SUM];Then
Echo"Checksumming ..."
Sum=`/Usr/Bin/Sum$Outname '
Index=1
Fors in$Sum
Do
Case$Index in
1)Sum1=$S;
Index=2;
;;
2)Sum2=$S;
Index=3;
;;
Esac
Done
If[$Sum1!=Sum1-o$Sum2!=SUM2];Then
Echo"the download file appears to be corrupted. "
echo "please do not attempt To install this archive file. "
exit 1
fi
else echo "Can ' t find /usr/bin/sum to do checksum. continuing anyway. " fiecho "Done." exit 0
#此文件YYYY. Bin can be reused, outname,sum1,sum2 are identifiers that represent the path of zip,rpm to be packaged into the bin, sum of checksum and filesize.
# User Agreement office: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#Tail-n +AAA $0 > $outname,aaa for this sh file, line count, this command is to extract the zip or rpm behind SH in the bin;
# sum is used to detect whether the extracted zip or rpm files are correct;
#最后一定要exit 0, be sure to.
#也可以在退出前云新unzip或rpm来安装, or the user can install the zip or rpm by themselves.
2) Composition of zip,gz or RPM (example: xxxx.rpm)
This is the zip or rpm you want to install.
3) Create a script for the bin installation file sh (example: createbin.sh, using the above yyyy.sh and xxxx.rpm)
#!/Bin/Sh
PATH=.:$PATH
Rpm=Xxxx.Rpm
Licensebin=YYYY.Bin
BASE=$(BaseName$Rpm.Rpm)
Sum=' Sum$RPM '
Index=1
Fors in$Sum
Do
Case$Index in
1)Sum1=$S;
Index=2;
;;
2)Sum2=$S;
Index=3;
;;
Esac
Done
Cat$Licensebin | SED-E s/Outname/$Rpm/-E S/SUM1/$Sum1/-E S/SUM2/$Sum2/>Linux_license_newbin
Dos2unix -k -q linux_license_new bin
Cat linux_license_new. bin $rpm < Span style= "color: #000000;" >> ${base}-rpm< Span style= "color: #000000;" >. bin
Sudo chmod a+ x res/${base}- Rpm. Bin
# Dos2unix Make sure the license shell is in Linux format;
#且此shell文件需要在Linux上执行;
Five references: http://itboba.com/taxonomy/term/1015
Finish!
Linux Bin file Authoring