#!/bin/sh -e

cp /usr/sbin/gainroot /usr/sbin/gainroot.old
echo '
#!/bin/sh
#From Andrey Gubarev easyroot.
trap exit SIGHUP SIGINT SIGTERM
PATH=/bin:/usr/bin:/sbin:/usr/sbin
if [ "$1" = "--use-su" ]
then
  exec su -
else
  echo "Root shell enabled"
  /bin/sh
fi
' > /usr/sbin/gainroot
chmod 4755 /usr/bin/rootsh
exit 0
