_tmp_dir=tmp/busybox.upgrade

post_install() {
  echo "You may want to do setuid on /usr/bin/busybox"
  echo "  chmod 4555 /usr/bin/busybox"
}

pre_upgrade() {
  mkdir ${_tmp_dir} || exit 1
  busybox stat -c %a usr/bin/busybox >${_tmp_dir}/busybox.upgrade.script
}

post_upgrade() {
  [ -f ${_tmp_dir}/busybox.upgrade.script ] && busybox chmod `busybox cat ${_tmp_dir}/busybox.upgrade.script` usr/bin/busybox
  busybox rm -rf ${_tmp_dir}
}
