Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # This script links to busybox
- # function: print and execute command
- exe()
- {
- echo "# ""$1"
- echo "--------------------------------------------------------------------------------"
- $1
- }
- out=$PWD/out
- busybox=/bin/busybox-new
- cmds=`$busybox --help|grep "^Currently defined functions:-*$" -A30|grep \,`
- for cmd in $cmds
- do
- cmd=`echo "$cmd" | sed s/,//g`
- cmdo=`which $cmd 2>/dev/null`
- # command exists?
- if [ -x "$cmdo" ];then
- # link not yet created?
- if ! [ -x "$out$cmdo" ]; then
- echo "[*] "`man -f $(basename $cmdo)|head -n1|cut -d "-" -f2`
- # create the dir?
- d=`dirname "$out$cmdo"`
- if ! [ -d "$d" ];then
- exe "mkdir -p "$d""
- fi
- # create the link
- exe "ln -s $busybox $out$cmdo"
- fi
- fi
- done
- exe "mkdir -p $out$(dirname $busybox)"
- exe "cp -f $busybox $out$busybox"
Add Comment
Please, Sign In to add comment