self extracting shell script
2013-06-14 00:00
246 查看
self extracting shell script
*) The payload
*) files (binaries, tarballs, text files, etc.)
*) installer
*) The builder script
*) The decompression script
See http://www.linuxjournal.com/node/1005818 for more info.
*) The payload
*) files (binaries, tarballs, text files, etc.)
*) installer
*) The builder script
*) The decompression script
chenqi@pek-qchen1-d1:~/Test/installer$ find . . ./decompress ./build ./payload ./payload/installer ./payload/display.tar chenqi@pek-qchen1-d1:~/Test/installer$ cat decompress #!/bin/bash echo "" echo "Self Extracting Installer" echo "" export TMPDIR=`mktemp -d /tmp/selfextract.XXXXXX` ARCHIVE=`awk '/^__ARCHIVE_BELOW__/ {print NR + 1; exit 0; }' $0` tail -n+$ARCHIVE $0 | tar xzv -C $TMPDIR CDIR=`pwd` cd $TMPDIR ./installer cd $CDIR rm -rf $TMPDIR exit 0 __ARCHIVE_BELOW__ chenqi@pek-qchen1-d1:~/Test/installer$ cat build #!/bin/bash cd payload tar cf ../payload.tar ./* cd .. if [ -e "payload.tar" ]; then gzip payload.tar if [ -e "payload.tar.gz" ]; then cat decompress payload.tar.gz > selfextract.bsx else echo "payload.tar.gz does not exist" exit 1 fi else echo "payload.tar does not exist" exit 1 fi chmod a+x selfextract.bsx echo "selfextract.bsx created" exit 0chenqi@pek-qchen1-d1:~/Test/installer$ cat payload/installer #!/bin/bash echo "Running Installer ... " DEST=$HOME/Test/dest echo "Installing files into $DEST ... " mkdir -p $DEST tar -xf ./display.tar -C $DEST echo "Installation Finished"chenqi@pek-qchen1-d1:~/Test/installer$ ./build selfextract.bsx created chenqi@pek-qchen1-d1:~/Test/installer$ ./selfextract.bsx Self Extracting Installer ./display.tar ./installer Running Installer ... Installing files into /home/chenqi/Test/dest ... Installation Finished chenqi@pek-qchen1-d1:~/Test/installer$ find . . ./selfextract.bsx ./payload.tar.gz ./decompress ./build ./payload ./payload/installer ./payload/display.tar chenqi@pek-qchen1-d1:~/Test/installer$ ls ../dest/ display2.c display.c
See http://www.linuxjournal.com/node/1005818 for more info.
相关文章推荐
- exit properly shell script
- Linux的学习笔记05:编写shell script
- php中$_SERVER[PHP_SELF] 和 $_SERVER[SCRIPT_NAME]之间的区别
- PHP_SELF、 SCRIPT_NAME、 REQUEST_URI区别
- How to execute shell script in Java?
- PHP_SELF、 SCRIPT_NAME、 REQUEST_URI区别
- shell-script(command groups)
- A Mainframe IDE Powered By Unix Technology [11] - Submit JCL from ftp command or shell script
- linux/unix shell bash script 小记
- [Linux] Single quote vs. Double quote inside Shell script
- Bash Shell Script Tutorials
- $_SERVER['PHP_SELF']、$_SERVER['SCRIPT_NAME'] 与 $_SERVER['REQUEST_URI']三者的区别
- linux基础之Shell Script入门介绍
- Shell script Awk
- 【Unix/Linux.Shell Script】函数
- PHP $_SERVER["SCRIPT_NAME"]、$_SERVER["PHP_SELF"]、$_SERVER["QUERY_STRING"]、$_SERVER["REQUEST_URI"]
- shell script 学习笔记-----shell变量
- shell script : stop program
- shell script
- Sample Shell Script To Loop Through All Files