rmtree: import more code from slapos.core to support case of parent directory not writable

2 jobs for tomo/fix_rmtree in 0 seconds
Status Job ID Name Coverage
  External
passed SlapOS.Buildout.UnitTest-FixRmtree.Python2

00:13:11

passed SlapOS.Buildout.UnitTest-FixRmtree.Python3

00:26:42