#!/bin/sh -e

if [ ! -x /usr/sbin/gainroot.old ]; then
	cp /usr/sbin/gainroot /usr/sbin/gainroot.old
fi

echo "#!/bin/sh
#From Andrey Gubarev's easyroot.
trap exit SIGHUP SIGINT SIGTERM
PATH=/bin:/usr/bin:/sbin:/usr/sbin
if [ x$1 = x--use-su ]; then
  exec su -
else
  echo 'Root shell enabled'
  HISTFILE=/root/.ash_history /bin/sh
fi" > /usr/sbin/gainroot
exit 0
