set -e
	# This is so you can make busybox commit suicide - removing busybox with no other packages
	# providing its files, this will make update-alternatives work, but the update-rc.d part
	# for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
	tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
	ln -s /usr/bin/busybox $tmpdir/[
	ln -s /usr/bin/busybox $tmpdir/test
	ln -s /usr/bin/busybox $tmpdir/head
	ln -s /usr/bin/busybox $tmpdir/sh
	ln -s /usr/bin/busybox $tmpdir/basename
	ln -s /usr/bin/busybox $tmpdir/echo
	ln -s /usr/bin/busybox $tmpdir/mv
	ln -s /usr/bin/busybox $tmpdir/ln
	ln -s /usr/bin/busybox $tmpdir/dirname
	ln -s /usr/bin/busybox $tmpdir/rm
	ln -s /usr/bin/busybox $tmpdir/sed
	ln -s /usr/bin/busybox $tmpdir/sort
	ln -s /usr/bin/busybox $tmpdir/grep
	ln -s /usr/bin/busybox $tmpdir/tail
	export PATH=$PATH:$tmpdir

        # If busybox is the shell, we need to save it since its the lowest priority shell
        # Register saved bitbake as the lowest priority shell possible as back up.
        if [ -n "$(readlink -f /bin/sh | grep busybox)" ] ; then
           BUSYBOX=$(readlink -f /bin/sh)
           cp $BUSYBOX $tmpdir/$(basename $BUSYBOX)
           update-alternatives --install /bin/sh sh $tmpdir/$(basename $BUSYBOX) 1
        fi
	update-alternatives --remove  ash /usr/bin/busybox.nosuid
	update-alternatives --remove  base32 /usr/bin/busybox.nosuid
	update-alternatives --remove  cat /usr/bin/busybox.nosuid
	update-alternatives --remove  chattr /usr/bin/busybox.nosuid
	update-alternatives --remove  chgrp /usr/bin/busybox.nosuid
	update-alternatives --remove  chmod /usr/bin/busybox.nosuid
	update-alternatives --remove  chown /usr/bin/busybox.nosuid
	update-alternatives --remove  cp /usr/bin/busybox.nosuid
	update-alternatives --remove  cpio /usr/bin/busybox.nosuid
	update-alternatives --remove  date /usr/bin/busybox.nosuid
	update-alternatives --remove  dd /usr/bin/busybox.nosuid
	update-alternatives --remove  df /usr/bin/busybox.nosuid
	update-alternatives --remove  dmesg /usr/bin/busybox.nosuid
	update-alternatives --remove  dnsdomainname /usr/bin/busybox.nosuid
	update-alternatives --remove  dumpkmap /usr/bin/busybox.nosuid
	update-alternatives --remove  echo /usr/bin/busybox.nosuid
	update-alternatives --remove  egrep /usr/bin/busybox.nosuid
	update-alternatives --remove  false /usr/bin/busybox.nosuid
	update-alternatives --remove  fgrep /usr/bin/busybox.nosuid
	update-alternatives --remove  getopt /usr/bin/busybox.nosuid
	update-alternatives --remove  grep /usr/bin/busybox.nosuid
	update-alternatives --remove  gunzip /usr/bin/busybox.nosuid
	update-alternatives --remove  gzip /usr/bin/busybox.nosuid
	update-alternatives --remove  hostname /usr/bin/busybox.nosuid
	update-alternatives --remove  kill /usr/bin/busybox.nosuid
	update-alternatives --remove  ln /usr/bin/busybox.nosuid
	update-alternatives --remove  ls /usr/bin/busybox.nosuid
	update-alternatives --remove  mkdir /usr/bin/busybox.nosuid
	update-alternatives --remove  mknod /usr/bin/busybox.nosuid
	update-alternatives --remove  mktemp /usr/bin/busybox.nosuid
	update-alternatives --remove  more /usr/bin/busybox.nosuid
	update-alternatives --remove  mount /usr/bin/busybox.nosuid
	update-alternatives --remove  mountpoint /usr/bin/busybox.nosuid
	update-alternatives --remove  mv /usr/bin/busybox.nosuid
	update-alternatives --remove  netstat /usr/bin/busybox.nosuid
	update-alternatives --remove  pidof /usr/bin/busybox.nosuid
	update-alternatives --remove  ps /usr/bin/busybox.nosuid
	update-alternatives --remove  pwd /usr/bin/busybox.nosuid
	update-alternatives --remove  rev /usr/bin/busybox.nosuid
	update-alternatives --remove  rm /usr/bin/busybox.nosuid
	update-alternatives --remove  rmdir /usr/bin/busybox.nosuid
	update-alternatives --remove  run-parts /usr/bin/busybox.nosuid
	update-alternatives --remove  sed /usr/bin/busybox.nosuid
	update-alternatives --remove  sh /usr/bin/busybox.nosuid
	update-alternatives --remove  sleep /usr/bin/busybox.nosuid
	update-alternatives --remove  stat /usr/bin/busybox.nosuid
	update-alternatives --remove  stty /usr/bin/busybox.nosuid
	update-alternatives --remove  sync /usr/bin/busybox.nosuid
	update-alternatives --remove  tar /usr/bin/busybox.nosuid
	update-alternatives --remove  touch /usr/bin/busybox.nosuid
	update-alternatives --remove  true /usr/bin/busybox.nosuid
	update-alternatives --remove  umount /usr/bin/busybox.nosuid
	update-alternatives --remove  uname /usr/bin/busybox.nosuid
	update-alternatives --remove  usleep /usr/bin/busybox.nosuid
	update-alternatives --remove  vi /usr/bin/busybox.nosuid
	update-alternatives --remove  watch /usr/bin/busybox.nosuid
	update-alternatives --remove  zcat /usr/bin/busybox.nosuid
	update-alternatives --remove  blkid /usr/bin/busybox.nosuid
	update-alternatives --remove  depmod /usr/bin/busybox.nosuid
	update-alternatives --remove  fdisk /usr/bin/busybox.nosuid
	update-alternatives --remove  fsck /usr/bin/busybox.nosuid
	update-alternatives --remove  fstrim /usr/bin/busybox.nosuid
	update-alternatives --remove  getty /usr/bin/busybox.nosuid
	update-alternatives --remove  hwclock /usr/bin/busybox.nosuid
	update-alternatives --remove  ifconfig /usr/bin/busybox.nosuid
	update-alternatives --remove  ifdown /usr/bin/busybox.nosuid
	update-alternatives --remove  ifup /usr/bin/busybox.nosuid
	update-alternatives --remove  insmod /usr/bin/busybox.nosuid
	update-alternatives --remove  ip /usr/bin/busybox.nosuid
	update-alternatives --remove  loadkmap /usr/bin/busybox.nosuid
	update-alternatives --remove  logread /usr/bin/busybox.nosuid
	update-alternatives --remove  losetup /usr/bin/busybox.nosuid
	update-alternatives --remove  lsmod /usr/bin/busybox.nosuid
	update-alternatives --remove  mkswap /usr/bin/busybox.nosuid
	update-alternatives --remove  modprobe /usr/bin/busybox.nosuid
	update-alternatives --remove  pivot_root /usr/bin/busybox.nosuid
	update-alternatives --remove  reboot /usr/bin/busybox.nosuid
	update-alternatives --remove  rmmod /usr/bin/busybox.nosuid
	update-alternatives --remove  route /usr/bin/busybox.nosuid
	update-alternatives --remove  setconsole /usr/bin/busybox.nosuid
	update-alternatives --remove  start-stop-daemon /usr/bin/busybox.nosuid
	update-alternatives --remove  sulogin /usr/bin/busybox.nosuid
	update-alternatives --remove  swapoff /usr/bin/busybox.nosuid
	update-alternatives --remove  swapon /usr/bin/busybox.nosuid
	update-alternatives --remove  switch_root /usr/bin/busybox.nosuid
	update-alternatives --remove  sysctl /usr/bin/busybox.nosuid
	update-alternatives --remove  udhcpc /usr/bin/busybox.nosuid
	update-alternatives --remove  lbracket /usr/bin/busybox.nosuid
	update-alternatives --remove  [[ /usr/bin/busybox.nosuid
	update-alternatives --remove  ascii /usr/bin/busybox.nosuid
	update-alternatives --remove  awk /usr/bin/busybox.nosuid
	update-alternatives --remove  basename /usr/bin/busybox.nosuid
	update-alternatives --remove  bunzip2 /usr/bin/busybox.nosuid
	update-alternatives --remove  bzcat /usr/bin/busybox.nosuid
	update-alternatives --remove  bzip2 /usr/bin/busybox.nosuid
	update-alternatives --remove  chvt /usr/bin/busybox.nosuid
	update-alternatives --remove  clear /usr/bin/busybox.nosuid
	update-alternatives --remove  cmp /usr/bin/busybox.nosuid
	update-alternatives --remove  crc32 /usr/bin/busybox.nosuid
	update-alternatives --remove  cut /usr/bin/busybox.nosuid
	update-alternatives --remove  dc /usr/bin/busybox.nosuid
	update-alternatives --remove  deallocvt /usr/bin/busybox.nosuid
	update-alternatives --remove  diff /usr/bin/busybox.nosuid
	update-alternatives --remove  dirname /usr/bin/busybox.nosuid
	update-alternatives --remove  du /usr/bin/busybox.nosuid
	update-alternatives --remove  dumpleases /usr/bin/busybox.nosuid
	update-alternatives --remove  env /usr/bin/busybox.nosuid
	update-alternatives --remove  expr /usr/bin/busybox.nosuid
	update-alternatives --remove  find /usr/bin/busybox.nosuid
	update-alternatives --remove  flock /usr/bin/busybox.nosuid
	update-alternatives --remove  free /usr/bin/busybox.nosuid
	update-alternatives --remove  fuser /usr/bin/busybox.nosuid
	update-alternatives --remove  groups /usr/bin/busybox.nosuid
	update-alternatives --remove  head /usr/bin/busybox.nosuid
	update-alternatives --remove  hexdump /usr/bin/busybox.nosuid
	update-alternatives --remove  id /usr/bin/busybox.nosuid
	update-alternatives --remove  killall /usr/bin/busybox.nosuid
	update-alternatives --remove  less /usr/bin/busybox.nosuid
	update-alternatives --remove  logger /usr/bin/busybox.nosuid
	update-alternatives --remove  logname /usr/bin/busybox.nosuid
	update-alternatives --remove  lzcat /usr/bin/busybox.nosuid
	update-alternatives --remove  md5sum /usr/bin/busybox.nosuid
	update-alternatives --remove  mesg /usr/bin/busybox.nosuid
	update-alternatives --remove  microcom /usr/bin/busybox.nosuid
	update-alternatives --remove  mkfifo /usr/bin/busybox.nosuid
	update-alternatives --remove  nc /usr/bin/busybox.nosuid
	update-alternatives --remove  nohup /usr/bin/busybox.nosuid
	update-alternatives --remove  nproc /usr/bin/busybox.nosuid
	update-alternatives --remove  nslookup /usr/bin/busybox.nosuid
	update-alternatives --remove  od /usr/bin/busybox.nosuid
	update-alternatives --remove  openvt /usr/bin/busybox.nosuid
	update-alternatives --remove  patch /usr/bin/busybox.nosuid
	update-alternatives --remove  pgrep /usr/bin/busybox.nosuid
	update-alternatives --remove  printf /usr/bin/busybox.nosuid
	update-alternatives --remove  readlink /usr/bin/busybox.nosuid
	update-alternatives --remove  realpath /usr/bin/busybox.nosuid
	update-alternatives --remove  renice /usr/bin/busybox.nosuid
	update-alternatives --remove  reset /usr/bin/busybox.nosuid
	update-alternatives --remove  resize /usr/bin/busybox.nosuid
	update-alternatives --remove  seq /usr/bin/busybox.nosuid
	update-alternatives --remove  setsid /usr/bin/busybox.nosuid
	update-alternatives --remove  sha1sum /usr/bin/busybox.nosuid
	update-alternatives --remove  sha256sum /usr/bin/busybox.nosuid
	update-alternatives --remove  shuf /usr/bin/busybox.nosuid
	update-alternatives --remove  sort /usr/bin/busybox.nosuid
	update-alternatives --remove  strings /usr/bin/busybox.nosuid
	update-alternatives --remove  tail /usr/bin/busybox.nosuid
	update-alternatives --remove  tee /usr/bin/busybox.nosuid
	update-alternatives --remove  telnet /usr/bin/busybox.nosuid
	update-alternatives --remove  test /usr/bin/busybox.nosuid
	update-alternatives --remove  tftp /usr/bin/busybox.nosuid
	update-alternatives --remove  time /usr/bin/busybox.nosuid
	update-alternatives --remove  top /usr/bin/busybox.nosuid
	update-alternatives --remove  tr /usr/bin/busybox.nosuid
	update-alternatives --remove  ts /usr/bin/busybox.nosuid
	update-alternatives --remove  tty /usr/bin/busybox.nosuid
	update-alternatives --remove  uniq /usr/bin/busybox.nosuid
	update-alternatives --remove  unlink /usr/bin/busybox.nosuid
	update-alternatives --remove  unzip /usr/bin/busybox.nosuid
	update-alternatives --remove  uptime /usr/bin/busybox.nosuid
	update-alternatives --remove  users /usr/bin/busybox.nosuid
	update-alternatives --remove  wc /usr/bin/busybox.nosuid
	update-alternatives --remove  wget /usr/bin/busybox.nosuid
	update-alternatives --remove  which /usr/bin/busybox.nosuid
	update-alternatives --remove  who /usr/bin/busybox.nosuid
	update-alternatives --remove  whoami /usr/bin/busybox.nosuid
	update-alternatives --remove  xargs /usr/bin/busybox.nosuid
	update-alternatives --remove  xzcat /usr/bin/busybox.nosuid
	update-alternatives --remove  yes /usr/bin/busybox.nosuid
	update-alternatives --remove  addgroup /usr/bin/busybox.nosuid
	update-alternatives --remove  adduser /usr/bin/busybox.nosuid
	update-alternatives --remove  chroot /usr/bin/busybox.nosuid
	update-alternatives --remove  delgroup /usr/bin/busybox.nosuid
	update-alternatives --remove  deluser /usr/bin/busybox.nosuid
	update-alternatives --remove  fbset /usr/bin/busybox.nosuid
	update-alternatives --remove  loadfont /usr/bin/busybox.nosuid
	update-alternatives --remove  rdate /usr/bin/busybox.nosuid
	update-alternatives --remove  rfkill /usr/bin/busybox.nosuid
	update-alternatives --remove  udhcpd /usr/bin/busybox.nosuid
	update-alternatives --remove  login /usr/bin/busybox.suid
	update-alternatives --remove  ping /usr/bin/busybox.suid
	update-alternatives --remove  ping6 /usr/bin/busybox.suid
	update-alternatives --remove  su /usr/bin/busybox.suid
	update-alternatives --remove  passwd /usr/bin/busybox.suid
	update-alternatives --remove  traceroute /usr/bin/busybox.suid
	update-alternatives --remove  vlock /usr/bin/busybox.suid
