Scripts for porting binaries and their dependent libraries under Linux

Source: Internet
Author: User

#!/bin/bash#
#指定移植目录DEST=/mnt/Sysroot
#依赖库文件拷贝libcp () {LIBPATH=${1%/*} [!-D $DEST $libpath] && mkdir-p $DEST $libpath [!-e $DEST ${1}] && CP $ $DEST $libpath &&A mp echo "Copy Lib $ finished."} #程序本身的拷贝bincp () {cmdpath=${1%/*} [!-D $DEST $cmdpath] && mkdir-p $DEST $cmdpath [!-E $DEST ${1}] && cp $DEST $cmdpath for LIB in ' LDD $ | Grep-o "/.*lib\ (64\) \{0,1\}/[^[:space:]]\{1,\}"; Do libcp $LIB done} #定义传递参数read-P "Your command:" cmduntil [$CMD = = ' Q ']; Do it! Which $CMD &>/dev/null && echo "wrong command" && read-p "Input again:" CMD && continue Command= ' which $CMD | Grep-v "^alias" | Grep-o "[^[:space:]]\{1,\}" ' Bincp $COMMAND echo "copy $COMMAND finished." Read-p "Continue:" Cmddone

#!/bin/Bash # target=/mnt/sysroot Clearcmd () {if which$cmd &>/dev/NULL; ThenCmdpath=`which--skip-alias $cmd 'Else  Echo "No such command"return5  fi} cmdcopy () {Cmddir=`dirname$1`  [ -D ${target}${cmddir}] | |mkdir-P ${target}${cmddir} [-F ${target}${1} ] ||CP$1${target}${cmddir}} libcopy () { forLibinch' LDD $1|grep-O"/[^[:space:]]\{1,\}"`; DoLibdir=`dirname$lib ' [-D ${target}${libdir}] | |mkdir-P ${target}${libdir} [-f ${target}${lib}] | |CP$lib ${target}${libdir} Done  }   while true; DoRead-P"Enter a command:"cmdif["$cmd"=='quit'] ; Then  Echo "quit"Exit0  ficlearcmd $cmd [$? -eq5] &&continue cmdcopy $cmdPath libcopy $cmdPath Done  

Scripts for porting binaries and their dependent libraries under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.