1 #!/bin/bash
 2 #
 3 target=/mnt/sysroot
 4 [ -d $target ] || mkdir /mnt/sysroot
 5 
 6 read -p "A command:" command
 7 
 8 libcp() {
 9     for lib in $(ldd $1 | grep -o "[^[:space:]]*/lib[^[:space:]]*"); do
10         libdir=$(dirname $lib)
11     [ -d $target$libdir ] || mkdir -p $target$libdir
12     [ -f $target$lib ] || cp $lib $target$lib
13     done
14 }
15 
16 while [ "$command" != 'quit' ]; do
17     if ! which $command &> /dev/null; then
18     read -p "No search $command,enter again:" command
19     fi
20     command=$(which --skip-alias $command)
21     cmnddir=$(dirname $command)
22 
23     [ -d $target$cmnddir ] || mkdir -p $target$cmnddir
24     [ -f $target$command ] || cp $command $target$command
25     libcp $command
26 
27     read -p "A command or (quit):" command
28 done

 

posted on 2017-12-06 18:52  卢伸乐  阅读(3049)  评论(0编辑  收藏  举报