Guest User

Untitled

a guest
Jan 23rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. #!/bin/bash
  2. # This script links to busybox
  3.  
  4. # function: print and execute command
  5. exe()
  6. {
  7. echo "# ""$1"
  8. echo "--------------------------------------------------------------------------------"
  9. $1
  10. }
  11.  
  12. out=$PWD/out
  13. busybox=/bin/busybox-new
  14. cmds=`$busybox --help|grep "^Currently defined functions:-*$" -A30|grep \,`
  15.  
  16. for cmd in $cmds
  17. do
  18. cmd=`echo "$cmd" | sed s/,//g`
  19. cmdo=`which $cmd 2>/dev/null`
  20.  
  21. # command exists?
  22. if [ -x "$cmdo" ];then
  23.  
  24. # link not yet created?
  25. if ! [ -x "$out$cmdo" ]; then
  26. echo "[*] "`man -f $(basename $cmdo)|head -n1|cut -d "-" -f2`
  27.  
  28. # create the dir?
  29. d=`dirname "$out$cmdo"`
  30.  
  31. if ! [ -d "$d" ];then
  32. exe "mkdir -p "$d""
  33. fi
  34.  
  35. # create the link
  36. exe "ln -s $busybox $out$cmdo"
  37. fi
  38. fi
  39. done
  40.  
  41. exe "mkdir -p $out$(dirname $busybox)"
  42. exe "cp -f $busybox $out$busybox"
Add Comment
Please, Sign In to add comment