#!/command/execlineb
fdmove -c 2 1

s6-envdir env
multisubstitute {
	importas -i CONTAINER_NAME CONTAINER_NAME
	importas -i CONTAINER_USER CONTAINER_USER
}
multisubstitute {
	define CONTAINER_TMPFS /run/containers/${CONTAINER_NAME}.${CONTAINER_USER}
}
foreground { umount ${CONTAINER_TMPFS}/home }
foreground { umount ${CONTAINER_TMPFS}/run }
foreground { umount ${CONTAINER_TMPFS}/inbox }
foreground { umount ${CONTAINER_TMPFS}/tmp }
foreground { umount --recursive data/root/ }
foreground {
	if { test -f ${CONTAINER_TMPFS}/run/uncaught-logs/current }
	mv ${CONTAINER_TMPFS}/run/uncaught-logs/current data/lastlog
}
rm -rf ${CONTAINER_TMPFS}